cancel
Showing results for 
Search instead for 
Did you mean: 

Cube External Memory question

belair55
Associate III

Hi everyone,

I have recently starting becoming familiar with the M-Cortex structure and instruction set ( I was raised on Atmel MCUs in school and this is my first time working with M-Cortex and .thumb instructions) I am trying to learn as much as I can, but there is an impressive amount to learn. So, I have decided to just take it in small chunks as problems become relevant. I want to put a simple program (flash LED) out in an external QSPI flash part on a custom board. I was able to modify the SEGGER project for my part to get the QSPI to execute the erase and program functions properly and I can successfully erase through Jlink commander now. I think at this point I could get my program out into the external flash but my question is how do I get to the external flash on reset? I found and external memory example but it runs out of RAM to init QSPI and write to it from a UART. This makes sense to me from the perspective of trying to get something into external when either using a debugger to program or some other interface like USB, but what about when that device is removed and reset occurs? Wouldn't there need to be a bootloader-esque function pointer in internal flash to hand execution off to the program in external upon exiting the reset handler?

I am using IAR EWARM and I also found *.icf for linker scripts. I was thinking I could have a script that would know to stitch together my application and my bootloader in one executable. So, I would have my app put at the start for external flash and my bootloader in internal flash. Does this make sense or am I off the yellow brick road? I just have to figure out how to indicate that with IAR because it seems to want to produce an executable with a linker involved in project settings. I was thinking I would just have a *.bin (or something) that could be called into use with another linker script that would be for my application.

Sorry for the long post. I am new to this so I haven't created a solid picture or had much reinforcement on some of the stuff I am learning. Thanks in advance!

1 REPLY 1

Sounds like you have a reasonable grasp of the issues.

The code to stand up the QSPI interface and pins needs to be in the Internal Flash​, it can then access the external memory and transfer control to it.

You could split resources between the internal and external memories via the linker script or .ICF​ file for IAR. You would just have to be careful about not creating any dependencies on the external memory before it is initialized.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..