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...
Can you please provide:
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;
}
Hi Dave,
1. Regarding the elftosb compiline issue, VS2015 is required to build elftosb successfully. Please refer to Section 2 Development tools in Kinetis Bootloader v2.0.0 Release Notes.pdf for more details.
2. Regarding sb generating, it is highly recommended to generate SB file with srec file or binary file, KEIL, IAR, KDS, ARM-GCC all support generating srec easily. Of course, the elf file is also supported for SB file generation, but the elf file contains both RW data and RO data, some filters are required to filter the RW data out, otherwise, the elftosb tool will try to load all sections to SB file, which may hit the reserve RAM region, just as what you have seen in your case. Besides, the filter may vary among different project, it fully depends on the linker file.
I finally got MSC bootloader working on Freedom K64F. Here's what I had to do:
I've attached the code with the above bootloader bug fixes and enhancements.
I'll post a separate question about the security setup.
NXP: Please:
Thanks,
Best Regards, Dave
PS: If anyone wants to try this quickly on the K64F Freedom board, I've attached the prebuilt bootloader and example program. First, drag the bootloader BIN onto the mbed virtual drive. Then, unplug the debug USB, plug in the K64F USB, and drag the blinky SB file onto the bootloader's virtual drive.
Great work. Really saved my a^$e!
I spent hours today trying to work out why this stupid thing wouldn't work! I copied your modified files into my project and away it went! The source files were all good. The project files reference absolute paths eg source files and post build so needed a bit of a tickle up.
The supplied .ld file does not seem to work with srec files. It gives error: line 8: source type does not support sections. However, just using the basic file below seemed to work fine...
sources {
myElfFile = "led_demo_freedom_a000.srec";
}
section (0) {
erase all;
load myElfFile;
reset;
}
Thanks for all your work. I hope NXP pull their fingers out of their butts and apply the necessary changes to get this all working properly. And also support some more part numbers!!!
Cheers
Ashley
Congrats Dave for getting it working, and thanks very much for posting your updates. I'm quite curious to do a diff to see the bug fixes you did.
Dave, welcome to the battle. I also struggled with silly compile errors and the like to get things working. (Although I never tried building the elftosb tool.)
One thing you might try, is to convert a Srecord file to an .sb, not an ELF. The elf file contains RAM information which (in my experience) seemed to confuse the elftosb tool (or something). I had better results converting s-record files, which only contain flash information.
Given that the blinky app is so simple, just a few lines of code, you can easily build & download it (using jtag) on its own and confirm it works on your hardware. Also make sure you're building it for the correct start address. I don't know what it'll be for the K64, but it won't be 0x00000000 the start of flash; it'll be much further along in the flash to allow space in flash for the bootloader first - in my case I build the app for a start address of 0x8000, and my bootloader builds to a size of about 26kB so that's comfortably inside of the allocated 0x8000.
Good luck.
Frank.
Thanks Frank. I already checked the sample LED blink loading the debugger (works fine). Per your suggestion I also tried SREC, does not work either. I updated the question above to clarify all this. Lets hope NXP responds before my customer here says "move on to a different vendor"...