Do you have an example of a Flashloader used by J-Link DLL?
I found an ELF file SiFive_FE310_ARTYBoard_QSPI.elf for E31ARTY under the Devices\SiFive path in FreedomStudio 2019.08, but there is no source code.
Hi chrislee,
We implemented a bootloader for the HiFive1 that supports flash read/write. Perhaps that code would be helpful? https://github.com/wolfSSL/wolfBoot/blob/master/hal/hifive1.c
David Garske, wolfSSL
Cool! I’ve always wanted to write or find something to do this … and then maybe write a simple file system on top of it.
I don’t see the definition of RAM_FUNCTION. How does that work?
Also, we can’t incorporate GPL code into our code. Are you willing to change the license?
Hi bruce,
The RAM_FUNCTION is just an attribute tag to relocate the ROM code into a RAM region. See https://github.com/wolfSSL/wolfBoot/blob/master/include/image.h#L33
The open source version is GPLv2, but we also sell a commercial license of the code. You can email us anytime at facts@wolfssl.com to inquire.
David Garske, wolfSSL
Yes, I see.
The problem with this is it will use part of the very precious 16 KB of RAM permanently. It’s ok in transient code, but for use in an actual application I think you’d want it to copy itself to RAM (e.g. on to the stack) for every use.
With wolfBoot it only does this flash access when booting and swapping the flash regions. The RAM function is required because the HiFive1 has no internal flash and so it must page code from flash into RAM when executing it. For the direct Q-SPI flash access must disabled so it can access the flash directly. In your application code you could multi-purpose the RAM region and recopy the function code prior to writing to flash. When not writing to flash you could use the RAM for something else.
Yes, that’s what I just said.
Also, on the FE310-G002 in the HiFive1 rev B (and also the LoFive R1 and the new SparkFun boards) you can configure part of the icache as ITIM and copy the code there temporarily instead of using up precious DTIM.
This, sadly, is not an option on the FE310-G000 in the original HiFive1.
Hi David,
Thanks for your reply.
Actually, the flashloader I need is for loading through J-Link DLL to write binary code to flash when entering debug mode through J-Link ICE. I can’t load my flashloader at the moment, but my attempt to use SiFive_FE310_ARTYBoard_QSPI.elf with SiFive is normal, so I think that a special coding style may be needed.