Kinetis Bootloader 1.1.0 Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kinetis Bootloader 1.1.0 Problem

1,689 Views
juanma_clautron
Contributor II

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

Labels (1)
5 Replies

852 Views
mjbcswitzerland
Specialist V

Hi Juanma

I don't know that the BCA area settings are that relevant because if you have a board without an application loaded all these values are 0xff and its is possible to load with a default configuration. If you application keeps them empty at 0xff then the boot loader settings will not be changed in any way. Whatever their values, they don't affect the application - only the way that the boot loader operates later.

The fact that your application is not working will have more to do with the application itself (if using interrupts you will need to either set the VBA accordingly or move vectors to RAM, for example).

See the following for more KL25 references: http://www.utasker.com/kinetis/FRDM-KL25Z.html

See the following for for ideas for configuring for boot loader operation (valid also for KBOOT): http://www.utasker.com/forum/index.php?topic=1869.msg6789#msg6789

Regards

Mark

http://www.utasker.com/kinetis.html

852 Views
juanma_clautron
Contributor II

Hi Mark, thanks for the answer!

Probably you're right, but my question is easier:

- I have the Kinetis Bootloader 1.1.0 (bootloader + RGB LED app) and MyApp (just green LED app).

- I load the Bootloader in debug mode and it works perfectly for RGB LED app binary file provided by the package, but MyApp doesn't.

- So, what should I do to put MyApp by using the bootloader?

Thanks!

0 Kudos

852 Views
mjbcswitzerland
Specialist V

Hi Juanma

You need to load your application with KBOOT and then connect the debugger and see why the application doesn't run as you expect.

It may be that KBOOT is not jumping to the application (debugging KBOOT code will show why) and it may be that it is jumping to the application but the application is failing - in the second case you need to debug in your code that was jumped to to find out what is going wrong.

Regards

Mark

0 Kudos

852 Views
juanma_clautron
Contributor II

Hi Mark

You're right: the KBOOT is not jumping to MyApp because MyApp's bin file is not created correctly.

So, imagine that you create an app from zero (just a blinking led) with CodeWarrior. What should you do?

Thanks a lot

0 Kudos

852 Views
mjbcswitzerland
Specialist V

Hi Juanma

Just go here http://www.utasker.com/kinetis.html

There is a CW configuration for the KL25Z that works with KBOOT. Either work with a compete project framework or else copy the methods used.

Regards

Mark

0 Kudos