AnsweredAssumed Answered

Kinetis Bootloader 1.1.0 Problem

Question asked by Juanma Bailen on Jan 8, 2015

Hi people ^^

 

I'm trying to use the Kinetis Bootloader 1.1.0 and it works perfectly for the drag&drop apps attached in the package. Of course, all the documentation is very useful.

 

But I have a problem when I try to upgrade MyApp. I'm using CodeWarrior 10.6, the KL25Z platform, and the MyApp is simple: just LED green blinking, with a WAIT component. Compile and generate the .bin file.

 

I open the IAR project "...\FSL_Kinetis_Bootloader_1_1_0\targets\MKL25Z4\bootloader.eww" and download to my freedom board. Then, open the "...\FSL_Kinetis_Bootloader_1_1_0\bin\win\KinetisUpdater\KinetisUpdater.exe". If I load the "...\FSL_Kinetis_Bootloader_1_1_0\apps\led_demo\binaries\led_demo_FRDM-KL25Z_8000.bin" file it works perfectly, but if I load MyApp, it doesn't work

 

So I read the doc, and I need the BCA (Bootloader Configuration Area) in MyApp. By reading the "...\FSL_Kinetis_Bootloader_1_1_0\doc\Demo Applications User-s Guide for the Kinetis KL25Z Platforms.pdf", I get this:

 

"The Bootloader Configuration Area is located at offset 0x3C0 from the beginning of the User Application image". Sounds easy, but how???


At the IAR "...\FSL_Kinetis_Bootloader_1_1_0\FSL_Kinetis_Bootloader_1_1_0\apps\led_demo\led_demo_kl25z4.eww" project I found the file startup_MKL25Z4.s and found this:

 

------------------------------------------------------------------------------------------------------------------------

#ifdef BL_HAS_BOOTLOADER_CONFIG

        ; Fill to align with bootloader configuration area BCA.

        REPT    (0x3c0-0xc0)/4 ; 0xc0:0x3c0

        DCD     0xFFFFFFFF

        ENDR

__bootloaderConfigurationArea ; 0x3c0

        DCD     'kcfg'        ; [00:03] tag - Tag value used to validate the bootloader configuration data. Must be set to 'kcfg'.

        DCD     0xFFFFFFFF    ; [04:07] crcStartAddress

        DCD     0xFFFFFFFF    ; [08:0b] crcByteCount

        DCD     0xFFFFFFFF    ; [0c:0f] crcExpectedValue

        DCB     0xFF          ; [10:10] enabledPeripherals

        DCB     0xFF          ; [11:11] i2cSlaveAddress

#ifdef FREEDOM

        ; FRDM-KL25Z doesn't have boot pin so needs the default 5 second timeout

        DCW     5000          ; [12:13] peripheralDetectionTimeoutMs - Timeout in milliseconds for peripheral detection before jumping to application code

#else

        DCW     500           ; [12:13] peripheralDetectionTimeoutMs - Timeout in milliseconds for peripheral detection before jumping to application code

#endif

        DCW     0xFFFF        ; [14:15] usbVid

        DCW     0xFFFF        ; [16:17] usbPid

        DCD     0xFFFFFFFF    ; [18:1b] usbStringsPointer

        DCB     0xFF          ; [1c:1c] clockFlags - High Speed and other clock options

        DCB     0xFF          ; [1d:1d] clockDivider - One's complement of clock divider, zero divider is divide by 1

        DCW     0xFFFF        ; [1e:1f] reserved

#ifdef BL_HAS_FLASH_CONFIG

        ; Fill to align with flash configuration field.

        REPT    (0x400-0x3e0)/4   ; 0x3E0 - 0x3FF

        DCD     0xFFFFFFFF

        ENDR

#endif

#else

#ifdef BL_HAS_FLASH_CONFIG

        ; Fill to align with flash configuration field.

        REPT    (0x400-0xc0)/4 ; 0xc0:0x400

        DCD     0xFFFFFFFF

        ENDR

#endif

#endif

------------------------------------------------------------------------------------------------------------------------

 

But in CodeWarrior, I don't know how to put the magic 'kcfg' at 0x83C0. I've tried to change CPU > Build Options > Generate linker file > ROM/RAM Areas, and it generates the next ProccessorExpert.ld file.

 

MEMORY {

  m_interrupts (RX) : ORIGIN = 0x00008000, LENGTH = 0x000003C0

  m_bca       (RX) : ORIGIN = 0x000083C0, LENGTH = 0x00000040

  m_text      (RX) : ORIGIN = 0x00008400, LENGTH = 0x00017C00

  m_data      (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000

  m_cfmprotrom  (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010

}

 

Then, I use the IntFLASH component for writing the FLASH before PEx initializes (CPU > Build Options > User Initialization).

 

So, my question is: how can I locate de BCA??

 

Thanks in advance

Original Attachment has been moved to: kinetisboot_8000_LEDgreen.zip

Outcomes