Out of FLASH memory walkthrough with samples

Thank you so much for this amazing guide! As I was following along I made myself a TL;DR version for moving the code from FLASH to SRAM, which might be useful for others. It should really just work, but let me know if it doesn’t and I’ll edit it accordingly!

Prepping VS Code for running and debugging

in .vscode/launch.json:

  • change "preLaunchTask": "build_all_debug", to "preLaunchTask": "build_and_program_dfu",
  • in openOCDLaunchCommands, add "gdb_breakpoint_override hard" as the last step

Add a custom linker script to move code from DTCMRAM to SRAM

The custom linker script is optional if you don’t need to move code out of DTCMRAM at the moment, but IMO better to set this up for later while you’re doing the rest of these instructions :slight_smile:

  • make a copy of the submodules/libDaisy/core/STM32H750IB_sram.lds linker script at the root of your repo
  • in that copy, at the bottom of the .bss (NOLOAD) : section, change } > DTCMRAM to } > SRAM

Edit your Makefile

Add these 2 lines between your CPP_SOURCES and LIBDAISY_DIR commands:

APP_TYPE = BOOT_SRAM
LDSCRIPT = ./STM32H750IB_sram.lds  # double-check the location and name of your custom linker script

Update the bootloader on the DaisyPod

  • put the daisy into DFU mode by holding BOOT and pressing RESET button
  • in your terminal, at the top of your repo, type make program-boot to load the daisy bootloader in flash

Debug in VS Code

  • put daisy seed in DFU mode: Press and release RESET, then press and release BOOT
  • then F5 from VS Code should just work ™️

And that’s it! From now on whenever you want to debug/program your seed you’ll have to preset RESET, then BOOT

1 Like