AnsweredAssumed Answered

Bootloader MSC does not work, ELFTOSB source does not build

Question asked by Dave Nadler on Oct 21, 2016
Latest reply on Apr 9, 2017 by Ashley Duncan

I find in the bootloader reference manual that drag-and-drop to MSC only supports SB format files.
I found the ELFTOSB user guide, which states that the ELFTOSB executable is included in the bootloader package.
OK, I found the ELFTOSB executable, but...

  1. The bootloader package provides the elftosb sources, however they fail to build (using Visual Studio 2012):
    1. the Visual Studio solution is configured to target Windows XP !! (I fixed it).
    2. The standard header is missing an include of <stdint.h> !! (I fixed it)
    3. Whoops, there are numerous syntax errors in the sources, for example:
      Error    19    error C2334: unexpected token(s) preceding '{'; skipping apparent function body    c:\k64\nxp_kinetis_bootloader_2_0_0\apps\elftosb\elftosb2\ElftosbAST.h    46    1    elftosb2
  2. The examples provided for the bootloader do not include the necessary conversion from ELF to SB !!!
  3. I tried to use the BD file in the root of the LED blinker app, and while elftosb appears to work, the generated SB file does not work. At Frank's suggestion I also tried using SREC instead of ELF with same results (unlike ELF, SREC doesn't generate the incorrect RAM fill instructions below). I also tried changing "erase all" to section erases, with same result.
    make --no-print-directory post-build
    Build boot-loadable SB file
    elftosb.exe -V  -z -c C:\K64\NXP_Kinetis_Bootloader_2_0_0\apps\led_demo\src\led_demo_drn.bd -o led_demo_freedom_A000.sb led_demo_freedom_a000.elf
    warning: line 10: end address of address range is before start address
    warning: line 11: end address of address range is before start address
    warning: line 12: end address of address range is before start address
    warning: line 13: end address of address range is before start address
    Boot Section 0x00000000:
      ERAS | adr=0x0000a000 | cnt=0x00000004 | flg=0x0000
      ERAS | adr=0x0000a400 | cnt=0x00000004 | flg=0x0000
      ERAS | adr=0x0000a800 | cnt=0x00000004 | flg=0x0000
      ERAS | adr=0x0000ac00 | cnt=0x00000004 | flg=0x0000
      LOAD | adr=0x0000a000 | len=0x00000400 | crc=0xedb4632d | flg=0x0000
      LOAD | adr=0x0000a400 | len=0x00000010 | crc=0x7bf1a8b4 | flg=0x0000
      LOAD | adr=0x0000a410 | len=0x000005fc | crc=0x18f25f7b | flg=0x0000
      FILL | adr=0x1fff0000 | len=0x00000400 | ptn=0x00000000
      LOAD | adr=0x1fff0400 | len=0x00000084 | crc=0x64bc47db | flg=0x0000
      FILL | adr=0x1fff0484 | len=0x00000020 | ptn=0x00000000
      FILL | adr=0x1fff04a4 | len=0x00000004 | ptn=0x00000000
      FILL | adr=0x1fff04a8 | len=0x00000400 | ptn=0x00000000
      JUMP | adr=0x0000a4d9 | arg=0x00000000 | flg=0x0000
  4. When I drag&drop led_demo_freedom_A000.sb to the bootloader, the chip resets... but LEDs never blink.
    The STATUS.TXT file goes from "Ready" to "Transfe" and sits there like loader never completed.
  5. I get exactly the same results with pre-built bootloader (as with the bootloader I built with KDS specifying only MSC):
    C:\K64\NXP_Kinetis_Bootloader_2_0_0\targets\MK64F12\iar\binaries\freedom_bootloader.bin
  6. There are no prebuilt example SB files provided with the bootloader!
  7. The example LED program is built properly. If I directly flash the LED example, and then restart the board by plugging in only the K64F USB, the bootloader starts, then branches to the LED application and the LED blinks.
  8. This makes it certain there is something wrong with the ELFTOSB processor and/or the bootloader!
    We need your help in getting this resolved!
    Similar problems have been reported here: https://community.nxp.com/thread/436171

 

Can you please provide:

  1. An example BD file for the LED blink application, that creates an SB file which actually works with the bootloader?
  2. Current sources for ELFTOUSB that build correctly with Visual Studio?

 

Thanks!
Best Regards, Dave

 

PS: K64F Freedom board, latest Kinetis Studio 3.2.0, SDK2.0

PPS: Here's the BD file:
// Define one input file that will be the first file listed on the command line.
// The file can be either an ELF file or an S-record file.
sources {
     demo = extern(0);
}

 

// create a section
section (0) {
    //  erase all;
    erase 0x0000A000;
    erase 0x0000A400;
    erase 0x0000A800;
    erase 0x0000AC00;
    //erase 0x0000B000;
    //erase 0x0000B400;
    //erase 0x0000B800;
    //erase 0x0000BC00;

 

    // Doesn't work: load $A1*, $P1* from demo;
    load demo;

 

    // jump to entry point
     jump demo;
}

Outcomes