I've found this link which describes exactly what I'm experiencing in my K64. I've added a custom attribute section to Linker file for returning go and back from/to Kboot bootloader (by using a dedicated flag in specific location in flash).
Now the bin file has increased to 500MB (and using the blhost.exe, obviously takes forever...)
Alas, the startup.c does not have an 'init_data_bss' method.
Is the solution provided by stanish also works for the K64?
If so, what to change in the startup.c code?
Hello Roy,
Which IDE do you used ?
BR
Alice
KDS 3.2
Hello Roy,
About your code , relocate the flash to flash or RAM?
I refer to the below DOC try to reproduce your problem while no matter relocate the data into RAM or flash,
the size sill the same .
https://community.nxp.com/docs/DOC-104433
Could you please create a simple project, which can reproduce your problem , send it to me , thus
I can test it on my side .
BR
Alice
Thanks, Alice,
I want to save a flag ('appFlag') in ROM from boot loader, and read/write it from application.
Can I write this flag to m_text section?
What is the meaning of writing to an exist section (like m_text) or to define a new section in ROM or RAM, like I wrote here in linker file:
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0 - 0xE0000
appFlag (RW) : ORIGIN = 0x00020000, LENGTH = 0x00000002
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00040000
}
Hello Roy,
1. The "exist section" means the section has exist in the default linker file ,
"define a new section " is like you showing above, the appFlag(RW) section.
2.Refer to your information, I define a flag "appFlag", then relocate it into
0x20000. please have a look at my attachment demo. After build ,from the "k64_test1.map"
file , we can see the flash at 0x20000:
Also there is no change about the code size , below is the original one:
Hope it helps
ALice
Hi Alice,
I've written my linker file as follows:
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x0000A000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x0000A400, LENGTH = 0x000FFBF0 - 0xA400 - 0x100
appFlag (RX) : ORIGIN = 0xFFAF0, LENGTH = 0x100
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
}
/* Define output sections */
SECTIONS
{
/* placing appFlag section at given address: */
.my_section :
{
. = ALIGN(4);
KEEP(*(.MyappFlag)) /* keep my variable even if not referenced */
. = ALIGN(4);
} > appFlag
In such way the appFlag is in the last 256 bytes of flash.
nevertheless, no matter what I do, after the appFlag is written in the application, the SW goes to hard fault.
Only when writing the appFlag to m_data_2, as follows, can I read/write the appFlag section.
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x0000A000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x0000A400, LENGTH = 0x00075C00
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
}
/* placing appFlag section at given address:*/
.my_section 0x20020000 :
{
. = ALIGN(4);
KEEP(*(.MyappFlag)) /* keep my variable even if not referenced */
. = ALIGN(4);
} > m_data_2
What am I missing here? I understand here I'm writing to RAM, and before to ROM, right?
But why writing to ROM brings me to hard fault and RAM does not?
Hi Roy,
What about your flag size ?
Maybe you can share your project, then I will check it on my side.
BR
Alice