Hi,
I was able to start bootloader following FRDM-K64F bootloader example (unluckily there isn't MCUBOOT example for TWR-K21F120MA),
that switch between kClockMode_FEI_21MHz and kClockMode_FEI_48MHz.
Now the problem is that bootloader not correctly jump to my application. I use a linker script quite similar to FRDK-64F example.
This is memory configuration for my bootloader:
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
/* 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 = 0x00020000
}
and this is memory configuration for my application:
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
/* Specify the memory areas */
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x0000a000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x0000a400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x0000a410, LENGTH = 0x000FFBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
}
I don't know if the problem is on bootloader or on application configuration, but
what I see is that when bootloader calculate application entry and stackpointer entry (function get_user_application_entry) it return different value than the example for frdm-k64f.
In frdm-k64f the value are:
application_entry: 0xa411
stackpointer_entry: 0x1fff0808
In my bootloader the value are:
application_entry: 0xac01
stackpointer_entry: 0x1fff8170
What can these differences depend on? Who determines these values?
Thank you in advance!