Questions about bootloading

Here’s what I’m doing to dev & test my project, which uses the bootloader:

  1. make changes
  2. make clean; make
  3. put patch in boot mode (reset + boot button)
  4. make program-boot
  5. hit reset, then boot so the LED flashes rapidly
  6. make program-dfu

First question: do I need to do make program-boot every time? or am I just loading the same bootloader code every time and I can skip 3 and 4?

Second question: right now, usually after I do make program-dfu the Patch restarts but it looks like starts the old program, freezes for 30 seconds, and then restarts with the new program. This hasn’t happened every time, but it’s happening consistently right now. What is even going on? Any ideas?

In fact it happens every time I reset – initially resets back to frozen, with whatever was formerly on the screen, freezes for 30 seconds, then restarts with the code running

Correct, you only need to flash the bootloader once and then it lives in the main flash memory. Only if you were to overwrite this flash with a program (using APP_TYPE = BOOT_NONE) will you need to reflash the bootloader after.

You can easily check if the bootloader is there by restarting the Daisy and seeing the onboard LED pulse on/off. Pressing the boot button will then keep the Daisy in bootloader mode, awaiting to be programmed.

For the second question I don’t have an answer, as I’ve never run into this. I’m assuming you are using BOOT_SRAM or BOOT_QSPI for your programs?

Do you have another Daisy you can try? This sounds somewhat like the persistent ‘bad QSPI’ state issue from a while back, there was a fix but not sure if it made it into the main branch yet.

There’s a couple of threads:

Thanks! I figured I didn’t need to do that step every time!

Thanks, I just skimmed through those threads and it doesn’t sound like quite the same thing. But I do have a couple of other Daisies, so I’ll try it out on them.

My gut says that somehow loading buggy code makes the startup wonky, since it seems to go away when I backtrack to my last stable code (but I need to check that more carefully). I’m working on using the SD card and I keep locking things up somewhere.

Well I figured out what is taking so long., I guess. I’m running the code below, and f_mount takes 32 seconds to complete. I see this issue came up before here, but I’m using QSPI already. Is there something else that needs to be done?

This doesn’t seem to be the problem @TallMike linked – it doesn’t happen before going into bootload mode, but once I’ve loaded my code, while trying to mount the file system.

                hw.display.Fill(false);
                SdmmcHandler::Config sd_cfg;
                sd_cfg.Defaults();
                sdcard.Init(sd_cfg);
                fsi.Init(FatFSInterface::Config::MEDIA_SD);
                hw.DelayMs(1000);
                FATFS& fs = fsi.GetSDFileSystem();
                f_mount(&fs, "/", 1);
                hw.DelayMs(1000);

The f_mount() call is failing with an error 1 – FR_DISK_ERR – “A hard error occurred in the low level disk I/O layer”

If there’s no SD card inserted, it fails immediately with 3 – FR_NOT_READY