Is there a way to store an array in flash on the STM32 like there is on AVR using PROGMEM and pgm_read_byte()?
I’m trying to store a few 16bit bitmaps in my program and it’s used up all my ram!
Is there a way to store an array in flash on the STM32 like there is on AVR using PROGMEM and pgm_read_byte()?
I’m trying to store a few 16bit bitmaps in my program and it’s used up all my ram!
You can use flash memory like that, it’s called IAP (in-application programming) in the user manual for the NXP chips. You can store the arrays in your program memory in the usual way, of course.
Leon
I do so, on an LPC2106. Note though that the bank size on this chip is 8KB, and this gets erased before writing. I tried but haven’t succeeded in erasing once and then writing to successively increasing smaller blocks in a circular arrangement as I’ve done in EEPROMs.
That depends on the language / development system you are using.peejay:
Is there a way to store an array in flash on the STM32 like there is on AVR using PROGMEM and pgm_read_byte()?I’m trying to store a few 16bit bitmaps in my program and it’s used up all my ram!
We can’t currently help you with STM32 development but if you use Armaide to develop on LPC2xxx systems you can associate arbitrary data files (e.g. bitmaps, fonts, numeric data etc.) with any module that can then be easily accessed like arrays from your application.
The data files are automatically appended to the executable at link time to be stored in flash.
You can try:
const uint16_t bitmap[BITMAP_WORD_COUNT] =
{
/* Here comes the constant bitmap data */
}
I tried the const thing and it didn’t work.
If it matters I’m using crossworks 2
You can get Crossworks support and access Crossworks-specific forums at:peejay:
If it matters I’m using crossworks 2