This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi All,
I need binary file to load the TM4C129 Controller using LM Flash player. I need the build steps (commands) to generate the binary file while compiling the project with GNU Compiler.
Regards,
M Srinivas.
Hi,
Your command is almost completely, the only missing switch is -S, which strips all debug and relocation info.
On a TM4C device flash starts at address 0x00000000 and SRAM starts at address 0x20000000 which is a 512MB difference.Srinivas Mula said:It is converting 771KB .out file into 512MB .bin file. Binary file should be less than 50KB.
If the .bin file is 512MB the probably reason is that the program contains loadable sections in both flash and SRAM, where as for a program to boot from flash (and generate a small .bin file) all loadable sections need to be in flash.
For the GNU compiler this is controlled by the .lds Linker script. Can you show the .lds file for your project.
[For information, see https://e2e.ti.com/support/development_tools/compiler/f/343/t/472718 for a similar problem of getting a 512MB .bin file when using the TI ARM compiler]
Looking at the options for the arm-none-eabi-ld in the gcc-arm-none-eabi-4_8-2014q3 tool chain in CCS 6.1.1 I can't see the equivalent of the --rom_model and --ram_model options in the TI ARM linker.Amit Ashara said:But there must be an option in the Linker as well for GCC.
The TI ARM code generation tools integrate the Initialization Model options in the linker (--ram_model / --rom_model) with the run time support library start-up code.
Whereas with the GNU compiler that is left to the linker script file and device specific run-time start-up code. In CCS 6.1.1 when a new project is created for a TM4C device the default linker script and the ResetISR code in the default *_startup_css_gcc.c source file effectively support the same as the --ram_model option in the TI ARM compiler, in that the data segement initializers are stored in flash and copied to SRAM during start up which results in a small .bin file being generated.
If you post the following that should provide information on why the .bin file is 512MB:Srinivas Mula said:It is converting 771KB .out file into 512MB .bin file. Binary file should be less than 50KB. This is my command "C:\ti\ccsv6\tools\compiler\gcc-arm-none-eabi-4_8-2014q3\bin\arm-none-eabi-objcopy.exe" -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin".
1) The .lds linker script file from the project.
2) The .map file generated by the linker.
3) The output from running the following command, which shows the loadable sections in the generated .out file:
C:\ti\ccsv6\tools\compiler\gcc-arm-none-eabi-4_8-2014q3\bin\arm-none-eabi-objdump.exe -h <.out file>
Hi Petrei,
Even after adding -S, still iam getting 512MB binary file. This is my command "C:\ti\ccsv6\tools\compiler\gcc-arm-none-eabi-4_8-2014q3\bin\arm-none-eabi-objcopy.exe" -S -O binary "file.out" "file.bin". LDS file is attached.
Regards,
M Srinivas
/****************************************************************************** * * Default Linker script for the Texas Instruments TM4C129XNCZAD * * This is derived from revision 12623 of the TivaWare Library. * *****************************************************************************/ MEMORY { FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00100000 SRAM (WX) : ORIGIN = 0x20000000, LENGTH = 0x00040000 } REGION_ALIAS("REGION_TEXT", FLASH); REGION_ALIAS("REGION_BSS", SRAM); REGION_ALIAS("REGION_DATA", SRAM); REGION_ALIAS("REGION_STACK", SRAM); REGION_ALIAS("REGION_HEAP", SRAM); REGION_ALIAS("REGION_ARM_EXIDX", FLASH); REGION_ALIAS("REGION_ARM_EXTAB", FLASH); SECTIONS { PROVIDE (_intvecs_base_address = DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x0); .intvecs (_intvecs_base_address) : AT (_intvecs_base_address) { KEEP (*(.intvecs)) } > REGION_TEXT PROVIDE (_vtable_base_address = DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000); .vtable (_vtable_base_address) : AT (_vtable_base_address) { KEEP (*(.vtable)) } > REGION_DATA .text : { CREATE_OBJECT_SYMBOLS *(.text) *(.text.*) . = ALIGN(0x4); KEEP (*(.ctors)) . = ALIGN(0x4); KEEP (*(.dtors)) . = ALIGN(0x4); __init_array_start = .; KEEP (*(.init_array*)) __init_array_end = .; *(.init) *(.fini*) } > REGION_TEXT AT> REGION_TEXT PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); .rodata : { *(.rodata) *(.rodata*) } > REGION_TEXT AT> REGION_TEXT .data : ALIGN (4) { __data_load__ = LOADADDR (.data); __data_start__ = .; *(.data) *(.data*) . = ALIGN (4); __data_end__ = .; } > REGION_DATA AT> REGION_TEXT .ARM.exidx : { __exidx_start = .; *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB .bss : { __bss_start__ = .; *(.shbss) *(.bss) *(.bss.*) *(COMMON) . = ALIGN (4); __bss_end__ = .; } > REGION_BSS AT> REGION_BSS .heap : { __heap_start__ = .; end = __heap_start__; _end = end; __end = end; KEEP(*(.heap)) __heap_end__ = .; __HeapLimit = __heap_end__; } > REGION_HEAP AT> REGION_HEAP .stack (NOLOAD) : ALIGN(0x8) { _stack = .; __stack = .; KEEP(*(.stack)) } > REGION_STACK AT> REGION_STACK }
Hi,
Looks like your .ld file is too crowded and a little bit disorganised, with some errors. How big is your file.out? depending on your program, if bigger than several MB, then you have a problem.
I have attached a .zip file, containing two linker files. Use first the tm4c...ld.txt (remove the .txt extension) - and if correctly .bin file, then that is. For your info, it is possible to use a modified version of TI's .cmd file - like I have done with uart-echo.ld file.
If still big generated .bin file, then is possible to be something wrong with your computer - try first to re-install the GNU package then if the same result, then you may have some viruses/rootkits (if WSEK-GNU-ICDI.zip
you observe same other unusual bigger files on your computer)
Running objdump on the .out file shows the problem is caused by the loadable .vtable section, which has both a VMA and LMA in flash:Srinivas Mula said:Project attached.
c:\ti_ccs6_0\ccsv6\tools\compiler\gcc-arm-none-eabi-4_7-2013q3\bin\arm-none-eabi-objdump.exe -h Sample.out Sample.out: file format elf32-littlearm Sections: Idx Name Size VMA LMA File off Algn 0 .intvecs 0000003c 00000000 00000000 00008000 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .vtable 00000360 20000000 20000000 00018000 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .text 00004510 00000040 00000040 00008040 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 3 .c_int00 00000044 00004550 00004550 0000c550 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 4 .rodata 000006cc 00004594 00004594 0000c594 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 5 .data 0000076c 20000360 00004c60 00010360 2**3 CONTENTS, ALLOC, LOAD, DATA 6 .bss 00000a54 20000ad0 20000ad0 00018360 2**3 ALLOC 7 .stack 00000200 20001528 20001528 00018360 2**3 ALLOC 8 xdc.meta 000000d0 000053cc 000053cc 00018360 2**2 CONTENTS, READONLY 9 .debug_info 00040717 00000000 00000000 00018430 2**0 CONTENTS, READONLY, DEBUGGING 10 .debug_abbrev 00006afb 00000000 00000000 00058b47 2**0 CONTENTS, READONLY, DEBUGGING 11 .debug_aranges 00001fa0 00000000 00000000 0005f648 2**3 CONTENTS, READONLY, DEBUGGING 12 .debug_ranges 00003390 00000000 00000000 000615e8 2**0 CONTENTS, READONLY, DEBUGGING 13 .debug_line 00014c05 00000000 00000000 00064978 2**0 CONTENTS, READONLY, DEBUGGING 14 .debug_str 000211d9 00000000 00000000 0007957d 2**0 CONTENTS, READONLY, DEBUGGING 15 .comment 000000e0 00000000 00000000 0009a756 2**0 CONTENTS, READONLY 16 .ARM.attributes 00000039 00000000 00000000 0009a836 2**0 CONTENTS, READONLY 17 .debug_frame 00005c88 00000000 00000000 0009a870 2**2 CONTENTS, READONLY, DEBUGGING 18 .debug_loc 0000b875 00000000 00000000 000a04f8 2**0 CONTENTS, READONLY, DEBUGGING
As this is a TI-RTOS project, I don't think the DK_TM4C129X.lds linker script in the project gets used. Will try and find out how to fix this problem for a TI-RTOS project.
To try and investigate I performed the following steps:Srinivas Mula said:Binary is generating, but it is not executing.
1) Imported your posted Sample project into CCS 6.1.1.00022, with compiler GNU v4.8.4 and TI-RTOS for TivaC v2.14.0.10
2) Modified the DK_TM4C129X.lds linker script to set NOLOAD on the .vtable section:
.vtable (_vtable_base_address) (NOLOAD) : { KEEP (*(.vtable)) } > REGION_DATA
3) In the DK_TM4C129X source file, changed the gpioPinConfigs array to match the Output pins connected to LEDs on a EK-TM4C1294XL.
I only performed this step as have a EK-TM4C1294XL LaunchPad and not a DK-TM4C129X Development Kit.
4) Compiled the project, and the generated .bin file size was 21444 bytes.
5) Used CCS to load the program into the EK-TM4C1294XL, and checked that it ran correctly in that the user LED was flashing.
6) Used Uniflash v3.4 to erase the EK-TM4C1294XL flash, and then power-cycled. Checked that this had erased the program loaded by CCS, in that the user LED was no longer flashing.
7) Use Uniflash v3.4 to program the .bin file into the EK-TM4C1294XL flash, and then power cycled. The program was running correctly in that the user LED was flashing.
Therefore, I can't repeat the failure (albeit using a different board).
As Amit has already suggested, checking if the program runs when loaded from CCS would be a good next step to investigate the cause of the problem.
Chester Gillon said:To try and investigate I performed the following steps:
Hello Chester
We really appreciate the added step you have taken to help the forum poster.
Regards
Amit
In my previous test, I didn't have to modify any other build step.Srinivas Mula said:I have modified .vtable. Is there any other build steps to be enabled or modified.
I may not be able to do that until Friday, as the PC I am currently using doesn't have the correct software installed to compile the project.Srinivas Mula said:Can you modify the attached project and attach again?
Can you just confirm under the CCS Project Properties -> RTSC which XDCtools version and which TI-RTOS for TivaC is in use. If you hover the mouse over the versions, does CCS display a warning about the version in the project not being used?Srinivas Mula said:Is there any other build steps to be enabled or modified.
Can you confirm that after loading the .out file from the CCS debugger, if you stop the CCS debug session and then power-cycle or reset the board does the program still execute correctly?Srinivas Mula said:with .out file it is executing fine
Wanted to check if not having the debugger connected stops the program from starting.
Hi Srinivas,
Srinivas Mula said:Hi Chester,
XDCtools version is 3.31.1.33_core and TI RTOS is 2.14.0.10. It is not executing .out file when debugger is removed.
Regards,
M Srinivas
If you have semi-hosting enabled, then the application will not work with the debugger removed. Please disable semi-hosting and rebuild the app.
Here's the link to a wiki page on this topic:
http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting
Hope this helps.
Best,
Ashish