Hi,
I want to burn a kernel in my maple board. I will be burning the kernel of ChibiOS. I want to know how do i burn it? The only way of programming the board right now is thru the IDE... so, do i burn the kernel also thru the IDE? Or some other interface is used to burn a kernel?
Burning a kernel in the maple
(9 posts) (6 voices)-
Posted 5 years ago #
-
May I ask a question?
Do you want:
1. the kernel to overwrite and replace the Maple bootloader, so that the kernel will become responsible for loading programs into Flash/RAM, or
2. is it okay for the Maple bootloader remaining in Flash, and eventually starting the kernel when there is nothing for it to load.In case 1 the kernel must have all of the necessary mechanisms to upload (I'm not familiar with it), and if it breaks, you'll have to resort to a serial bootloader or JTAG to rescue the board (but you'll need them anyway for this option, see below). The benefit is the kernel is 'in charge' unless someone has a serial bootloader, and cable, or JTAG.
In case 2 the Maple bootloader would overwrite the kernel, if a loader program talked to the Maple. This is probably fine for initial development.
I don't believe the Maple bootloader will overwrite itself (Leaf Labs please confirm), so I don't believe case 1 can be done through the IDE.
There are instructions in the bootloader source on how to burn a new Maple bootloader, so those are pretty much want would be needed to get your kernel loaded if case 1 is needed.
How to get the source is explained at http://leaflabs.com/docs/maple-bootloader/
The Makefile, at target 'program_serial:', has the commands to load a .bin program over the serial port (USART1). If your computer doesn't have a serial port, it'll need a USB to serial converter. USB to serial cables made by FTDI are popular, but there are lots of alternatives.
In the same Makefile, at target 'program:', are the commands to program the Flash over JTAG, using openocd.HTH
Posted 5 years ago # -
Hi tarinbansal,
You can upload compatible .bin files (compiled using any toolchain) via a hardware serial bootloader (built into the STM32 microcontroller), the JTAG interface, or the USB DFU upload bootloader that your Maple shipped with.
The code upload process is independent of the type of program you are uploading: if you want to upload a kernel, operating system, or program that does not use the SerialUSB object in libmaple you will loose the regular auto-reset feature in the IDE.
The IDE was not designed to be flexible for use with anything other than a standard bootloader, though everything is open source and you are free to develop a new mechanism to interact with a micro operating system instead. My guess is that if you want to upload a kernel which isn't built on top of libmaple you will want to abandon the entire LeafLabs software suite and upload over JTAG or the serial bootloader.
Everything gbulmer said is true as well (the bootloader is not /supposed/ to be able to overwrite itself), sorry if the duplication of information is confusing. If you give some more details of what you're trying to accomplish perhaps we can help!
Posted 5 years ago # -
tarinbansal,
This should be possible using the command line development environment instead of the IDE:
http://leaflabs.com/docs/libmaple/unix-toolchain/
If you can compile the chibios kernel using the maple toolchain, I think you can install it via the process outlined in the link above.
Posted 5 years ago # -
gbulmer, correct - the bootloader will not overwrite itself. Programs that are designed to work with the maple bootloader (like those you make when you use the ide) must be linked differently from regular programs so that they start at an offset in memory (currently 0x08005000 for flash builds and 0x20000C00 for ram builds). We thought about doing a bootloader-self-overwrite mode but that sounded too easy to accidentally brick your board. Perhaps now that the serial bootloader has proven itself effective, we could go ahead and allow this.
Posted 5 years ago # -
I accidentally uploaded a .elf-file (instead of .bin) today, and that seemed to make the bootloader whipe out itself (not able to upload anything, no ledblinks on reset etc.) But I managed to burn a new bootloader using the built in serial bootloader, so no bricked Maple :-)
Posted 5 years ago # -
hmmm. interesting. How big was the elf file? probably huge, since elf uses 1 byte to store a single character, i wonder if its possible that some number somewhere rolled over and killed the bootloader. Usually the compiler checks for size appropriate-ness and im not sure how vigilant the bootloader is about this. Either way, the bootloader is pretty data-agnostic, it just copies what it gets into memory, so while the user code certainly wouldnt work, im quite surprised the bootloader got bricked.
Posted 5 years ago # -
Yes it was kind of huge, 323364 bytes. The upload seemed to take very long time before I realized that something was wrong...
I was actually playing around with some "non-leaflabs" stuff with the Maple, just for fun. I was, for example, able to compile and run the blinky-example (without Circle-OS) from the stm32-primer. Then I went on to try Martin Thomas's port of FatFS, without success, even when I used the bin-file :-). But I used your link-script with the blinky, but not with the FatFS program. Maybe that's why it didn't work. I'll have another try tomorrow.Posted 5 years ago # -
ooooh, fatfs would be sweet. keep us posted. This has been in high demanded.
Posted 5 years ago #
Reply
You must log in to post.