You are here

Bootloading without a bootloader host | Cypress Semiconductor

Bootloading without a bootloader host

Summary: 5 Replies, Latest post by kmmankad on 02 May 2012 04:15 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Doug McClean's picture
38 posts


I'm interested in writing a custom bootloader. Unfortunately for what I am trying to do, all of the bootloader examples I can find talk about customizing either (a) critical tasks that the bootloader services in a similar way to how the bootloadable services them or (b) the communications channel between the bootloader and a bootloader host program.

I'd like to write a bootloader that loads the new program from an SD card. In my bootloadable project I already have the SPI interface to the SD card, and a port of the FatFS file system library. I can read and write binary files to the SD card.

It seems like it should be possible (but I could use a hint as to how) to write a bootloader that works like this:

  1. See if there's an SD card. If not, skip to bootloadable.
  2. See if it contains a file named "\firmware\program.hex" (or cycad, whatever the extension should be). If not, skip to bootloadable.
  3. See if the checksum in the header of that file matches the checksum of the currently installed bootloadable. If not, skip to bootloadable. (Or some other fast is-it-already-installed check.)
  4. Copy the new program to flash one row at a time, using the same strategy that the ordinary Cypress-provided bootloader does.
  5. Restart.

Am I missing a reason why this can't work? The reason I'd like to do it this way is because it means that field updates don't need a computer or any other smart bootloader host, they just need my customer to stick in the card I mailed them.

Thanks in advance for any advice you may have.

dboyette's picture
3 posts

Have you had any success with your SD card bootloader? We have a PSoC3 design in the field with an SD card slot and would like to offer the same, laptop-less firmware upgrade path.

uday's picture
Cypress Employee
569 posts


It is certainly possible to implement a SD Card based Bootloader. In this case PSoC has to act as master and read data from the EEPROM and bootload itself. This requires modification to the cyboot component. 

user_66945721's picture
256 posts

Yeah,this isnt difficult.

All you need to do is write a bootloader which utilizes a custom communication protocol,here SPI with the SD card.

Use the SD card component(emFile one.) thats included in Creator 2.0,and use its functions inside the 5 functions(start,stop,write read and something..) you need to write out to implement a bootloader that uses a custom communications protocol.There is an appnote on writing your custom bootloader,but I'm just too sleepy to find and paste the link here.The search box should serve you well.

I had a working solution to this effect before my harddisk crashed.(also had an almost working wireless bootloader too :( )

But that emFile thingy takes up a good deal of flash and ram.

Maybe it would be better to write out your own minimalist mmc interfacing code in assembly,so that it takes up very little code space,and executes faster too.

user_66945721's picture
256 posts

What I had setup was a bootloader that gave a menu on (USB)UART through which you could select which file to boot from in the SD card's root.

If no SD card was found,it would go bootload itself via USB HID.Else would go for the SD card.

Lots of possibilites here.Wireless  bootloading too,like I mentioned.I tried using the CYRF6936 wireless modules and created a custom bootloading component.

user_66945721's picture
256 posts

I hate exams.Havent tinkered with my psoc stuff since ages 'cuz of them.

Log in to post new comments.