Good Morning,
I'm doing the inclusion of a bootloader on uC Kinetis using the GCC compiler. For this I am using the document "MCU_Kinetis_GCC" but had the problem include the binary file described in step 14c the page 45. This step says the following:
14. INCLUDE filename
CW LCF:
.my_text{ INCLUDE filename }>my_text
GCC LD:
Equivalent syntax in GCC LD,
INPUT(file, file, ...) INPUT(file file ...)
Command line options to include binary file [default section as .data.]
NOTE
Binary filename: data.raw, Format: binary
a. Create a stationary project.
b. Go to Properties > C/C++Build > Settings > ARM Ltd. Windows GCC C
Linker > Miscellaneous > Other flags
c. Add the following options. -Wl,-b,binary,"C:/data.raw",-b, elf32-littlearm
This makes linker to treat data.raw as raw binary and resume to elf32-littlearm
for subsequent objects.
The final elf will contain the following symbols for the sources to manipulate the
data:
_binary_C___data_raw_start _binary_C___data_raw_end _binary_C__data_raw_size
The default linker section will be .data.
To place the raw data in a specified linker section, define the section in the
Linker command file.
a. Define the following section.
MEMORY{
..
m_srecord (RX) : ORIGIN = 0x0000C000, LENGTH = 0x00004000/*define its memory
segment*/
}
TARGET(binary)/* specify the file format of binary file */
INPUT (data.raw)/* provide the file name */
OUTPUT_FORMAT(default)/* restore the out file format */
/* Define output sections */
SECTIONS
{
.srecord :
{
data.raw (.data)
. = ALIGN (0x4);
} > m_srecord
.text:
{
..
}>m_text
}
b. Add the path of the file added in the previous step to ARM Ltd. GCC C
Linker->Libraries->Library search path (-L)
When I finish running this script the following error is generated by the compiler :
"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"MDL100_KL16Z128.args" -o"MDL100_KL16Z128.elf"
arm-none-eabi-gcc: error: elf32-littlearm: No such file or directory
mingw32-make: *** [MDL100_KL16Z128.elf] Error 1
The command that includes on step 14 (Add the following options. -Wl,-b,binary,"C:/data.raw",-b, elf32-littlearm) is the following:
-Wl,-b,binary,"${ProjDirPath}\FLASH\Boot_MK16Z128.bin",-b, elf32-littlearm
The command that includes on step 14 (Add the path of the file added in the previous step to ARM Ltd. GCC C Linker->Libraries->Library search path (-L)) is the following:
"${ProjDirPath}\FLASH\Boot_MK16Z128.bin"
Can you help me?
Solved! Go to Solution.
Hi Tiago,
I have been able to reproduce the issue you mention. When you copy the linker options from the document there is a space before elf32-littlearm:
-Wl,-b,binary,"C:/data.raw",-b, elf32-littlearm
This space is causing the issue, so please try removing the space and the error should be gone:
-Wl,-b,binary,"C:/data.raw",-b,elf32-littlearm
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Tiago,
I have been able to reproduce the issue you mention. When you copy the linker options from the document there is a space before elf32-littlearm:
-Wl,-b,binary,"C:/data.raw",-b, elf32-littlearm
This space is causing the issue, so please try removing the space and the error should be gone:
-Wl,-b,binary,"C:/data.raw",-b,elf32-littlearm
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for the answer , the solution provided is correct . The project is now compiling but still can not get the include " Boot_MK16Z128.bin ". I executed all the steps as indicated in section 14 of the document , however the data Boot loader still do not appear in .bin project that did include.
You have no idea what can be ?
Follows the excerpt from my LD file that do include :
MEMORY {
m_bootloader (RX) : ORIGIN = 0x00000000, LENGTH = 0x00004000
m_interrupts (RX) : ORIGIN = 0x00004000, LENGTH = 0x00000400
m_cfmprotrom (RX) : ORIGIN = 0x00004400, LENGTH = 0x00000100
m_app_info (RX) : ORIGIN = 0x00004500, LENGTH = 0x00000100
m_text (RX) : ORIGIN = 0x00004600, LENGTH = 0x0000D900
m_app_flash_vars (RX) : ORIGIN = 0x00011F00, LENGTH = 0x00000400
m_new_image (RX) : ORIGIN = 0x00012300, LENGTH = 0x0000D900
m_new_image_status (RX) : ORIGIN = 0x0001FC00, LENGTH = 0x00000400
m_data (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000
}
TARGET(binary)/* specify the file format of binary file */
INPUT (Boot_MK16Z128.bin)/* provide the file name */
OUTPUT_FORMAT(default)/* restore the out file format */
SECTIONS
{
.bootloader :
{
Boot_MK16Z128.bin (.Boot_MK16Z128)
. = ALIGN (0x4);
} > m_bootloader
.app_info :
{
* (.info)
KEEP(*(.info))
. = ALIGN(0x1);
} > m_app_info
...
...
...
}