Bug Labs Bootloader Code


Hi Craig/Jesse (or anyone else),

Do you know if the USB bootloader code is available as a stand alone package? It would be nice to be able to create a blank S5D9 project from scratch in e2 Studio, add the bootloader code, and then create an application. The simplest example would be a basic LED blinky, Since the board comes programmed with the bootloader, we could use that method to load new binaries that we create without having to use Jlink. Our new binaries would also include the bootloader, so that method would always be available.

If it is of interest, I could also go through the process of using Segger Jlink to upload a simple ‘blinky’ program and write that up as a tutorial. Let me know if you think that would be valuable. That would also be a quick easy way or restoring a factory image for those who have Jlink.




I contacted Renesas and received excellent tutorials from Renesas.

Get the files here.

Note that you’ll need a Segger Debugger for the tutorials.

You need to edit or use the top part of this script from Medium One.

My understanding is that you need to adjust the memory up per the example in that script. If you use the bootloader, then the bootloader occupies the memory space that your .srec file is trying to occupy. Thus, your .srec can’t load.

Here’s the explanation from Lakshan, co-founder of Medium One.

that snippet is the key, specifically the FLASH line. Note that the ORIGIN is not 0, it is offset by 0x20000 (128 kB). 0x20000 is the end of the memory region reserved for the bootloader; this is where your application must start. FYI, the bootloader has the following FLASH line in its linker script:

FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x0200000 /* 2M */

Ignore the LENGTH; we know the bootloader footprint is < 128 kB.

for an application that will be launched by the bootloader, you should use that linker script; the only difference between that one and the default S5D9 linker script that comes with an empty project is the ORIGIN setting for FLASH.

I believe you are asking about enabling the USB mass storage device in your application, so that when the board is running your application and is plugged into a computer it mounts as a USB mass storage device, just like in the diagnostics intelligence application, is that correct? If so, then yes you will need the code in system_thread_entry.c, which depends on the files under qspi_filesystem/.