10 years, 7 months ago.

Are any of the onchip EEPROM locations reserved for the mbed code?

I am using a LPCXpresso1549 with mbed and was just wondering if there were any limitations with using the onchip eeprom with the mbed libraries?

Also, with the mbed compiler, is there a way to force a variable to be located at a certain memory location?

1 Answer

10 years, 7 months ago.

A quick scan of the mbed library source (and the LPC15xx.h file) doesn't reveal any reference to the on-chip EEPROM.

Is there one, or are you referring to the flash controller?

Typically the mbed libs use a timer resource, but that's about all.

As for forcing a variable to be at a certain location, it would depend on what sort of memory you were referring to and what you were going to do with it.

The way the NXP headers do it for the SFRs is via a simple pointer cast:

#define LPC_ADC1                        ((LPC_ADC0_Type           *) LPC_ADC1_BASE)

In this case, the LPC_ADC0_Type is a struct typedef where all the fields are declared volatile, and some may be also declared as const.

For RAM or ROM, you could use the global placement operator ::new(size_t, void*) or a class-specific implementation.

In principle you can also force a variable to be anywhere in the memory by manually making a pointer, but that doesn't play nicely with the allocation of other variables, and I really don't see an advantage of doing it in the first place.

posted by Erik - 24 Apr 2014