SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By peejay
#83151
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!
User avatar
By leon_heller
#83158
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
By stevech
#83159
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.
By cfb
#83172
peejay wrote: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!
That depends on the language / development system you are using.

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.
By mlu
#83187
You can try:
Code: Select all
const uint16_t bitmap[BITMAP_WORD_COUNT] =
{
     /* Here comes the constant bitmap data */

}
By peejay
#83209
I tried the const thing and it didn't work.

If it matters I'm using crossworks 2
By cfb
#83211
peejay wrote:If it matters I'm using crossworks 2
You can get Crossworks support and access Crossworks-specific forums at:

http://rowley.zendesk.com/portal