본문 바로가기
DSP, MCU/TMS320F2838x (C28x)

TMS320F28388D ] CSS에서 bin 파일 생성하는 법, filling a hole with 0xFF not 0x00

by eteo 2023. 4. 23.

 

 

 

 

프로젝트를 빌드하면 기본적으로 .out 실행파일이 나오는데 바이너리 파일을 생성하기 위해서는 TI에서 제공하는 유틸을 사용하면 된다.

 

 

아래 경로에 있는 툴이고, 이걸 ccs의 post build step 기능으로 빌드와 동시에 bin 파일이 생성되게 할 수 있다.

C:\ti\ccs[Version No]\ccs\utils\tiobj2bin

 

 

 

 

 

 

 

 

 

 

프로젝트 우클릭 - Build - Steps - Post-build steps

 

 

 

해당 부분에 아래 문구를 적는다.

 

 

 

C28x 코어

"${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/ofd2000" "${CG_TOOL_ROOT}/bin/hex2000" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin"

 

CM 코어

"${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/armofd.exe" "${CG_TOOL_ROOT}/bin/armhex.exe" "${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe"

 

 

 

중간의 {CCS_INSTALL_ROOT}나 {CG_TOOL_ROOT}는 설치된 컴파일러나 IDE 버전에 따라 다르다. Properties - Linked Resources에서 확인할 수 있다.

 

C28x 코어 기준 .bin 파일 생성시 사용하는 프로그램은 ofd2000.exe, hex2000.exe, mkhex4bin, tiobj2bin.exe 이고,

CM 코어의 경우 .bin 파일 생성시 사용하는 프로그램은 armofd.exe, armhex.exe, mkhex4bin, tiobj2bin.exe 이다.

 

 

 

 

 

 

만약 용량이 생각보다 많거나 중간에 너무 큰 hole이 생긴다면?

플래시 섹션배치를 앞쪽부터 차곡차곡 쓰고 있나 확인해볼 필요가 있다.

 

 

 

 

 

 

 

 

 

 

 

hole을 0x00이 아니라 0xFF로 바꾸는법

 

tiobj2bin 배치파일을 편집해서 util의 --fill 옵션을 사용하면 된다.

 

 

 

아래 문장을 검색한다.

%hexcmd% -q -b -image -o %binfile% %hextmp% %outfile%

 

 

아래와 같이 수정한다.

 

 

 

C28x 코어

%hexcmd% -q -b -image --fill=0xffff -o %binfile% %hextmp% %outfile%

 

CM 코어

%hexcmd% -q -b -image --fill=0xffffffff -o %binfile% %hextmp% %outfile%

 

 

hole을 0xFF로 바꾸지 않을거면 굳이 수정할 필요가 없다.

 

 

 

.bin파일의 내용이 실제 플래시메모리에서 읽은 값과 시작주소부터 끝까지 동일한 것을 볼 수 있다.

 

 

 

 

아래문서 6.1.3.4. Pre and Post Build Steps 에서 더 자세한 내용을 볼 수 있다

 

https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_project-management.html

 

6.1. Creating and Managing Projects — Code Composer Studio 12.3.0 Documentation

When a CCS project is built for the first time or rebuilt, it goes through the following steps: 6.2.1.2.3. Main Build When a project is built in CCS, the main build is the step where the build commands and input files are passed to the Compiler tools, and

software-dl.ti.com