In continuous to this post, I've currently working with the Release version of the freedom_bootloader (with led's used for debug), and I cannot exit the bootloader mode.
I've altered the freedom_bootloader file so I chose a place in the flash (address 0x20020000) in which both my application and the boot loader will point to it, as follows:
In bl_main.c (and in my application) I've added this line:
unsigned char __attribute__((section (".appFlag"))) appFlag = 0x55;
In freedom_bootloader linker file:
/* Specify the memory areas */
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00040000
m_data_20020000 (RW) : ORIGIN = 0x20020000, LENGTH = 0x00000400
}
/* Define output sections */
SECTIONS
{
/* placing appFlag section at given address: */
.appFlag 0x20020000 :
{
KEEP(*(.appFlag)) /* keep my variable even if not referenced */
} > m_data_20020000
In my app linker file I placed it under m_data_2:
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
}
/* Define output sections */
SECTIONS
{
/* placing appFlag section at given address: */
.appFlag 0x20020000 :
{
KEEP(*(.appFlag)) /* keep my variable even if not referenced */
} > m_data_2
I also modified the linker file as explained nicely by @Jorge Adapting KDS project for KBOOT flash resident bootloader
I want the option to get back to the bootloader from my app. This is my goal...
In the boot loader I've added these lines (see line 367, 405). The appFlag will be altered so only if it is equal to 0x55 it will jump to app. If it equals to 0x22, it will do nothing (line 405).
The problem is it get stuck in boot loader mode. For the time being I'm working with the freedom_led_demo_A000 project.
If I comment line 367 and un-comment line 368 (set the 'If' to 'true'), it works fine and jump to application as expected, led starts to blink. This I totally do not understand. The appFlag does equal to 0x55 (as it gets initialized in _attribute_ , see start of my message).
Any idea?
Thanks, if you managed to read this far... :smileyhappy:
Roy
Hi Roy,
I noticed that the memory sections m_data and m_data_20020000 overlap in the bootloader, m_data goes from 0x1FFF0000 to 0x20030000. Please make sure the memory sections on you projects does not overlap, you could use the following document as guidance:
https://community.nxp.com/docs/DOC-104433
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer