I hope this is not a recurring question, but i don't seem to find anything on what i am trying to do. I am to store a small data structure (about 40 bytes in size) on a flash memory of the microprocessor as a look up table. The device can be interfaced to the PC, so that the end user can configure this table(without being able to program the micro) to suit the needs of his particular system. It would make sense to me to store it in an array and it would be convenient for me to access this data in code, however then i would need some way of forcing this array to point to a specific memory location. (Section of flash where the table is to be stored is not really flash but EEPROM and is configured and partitioned by me). Any ideas on how I could go about it ? (using kinetis K60DX256 micro, not much experience in storing data structures) Thanks
Asked
Active
Viewed 489 times
0
-
Is the memory device flash or EEPROM? Is the memory device's address space directly accessible via the microcontroller's address bus (parallel flash typically works this way)? Or is the memory device accessed through a serial interface such as SPI or I2C (serial EEPROMS typically work this way)? The implementation will vary greatly depending on the answers to these questions. – kkrambo Mar 25 '14 at 02:59
-
Physically it is a small volume of EEPROM memory that is backed up by flash. The module is internal to the microcnotroller and can be accessed directly via the address bus. I can read/write to it by just pointing to a right memory address. – Stani Mar 25 '14 at 10:39
-
I browsed the datasheet and I suppose you're talking about that FlexMemory. I'm not familiar with that but here is a general idea. These two steps can be used to locate data at a specific address. First declare a section at the desired address in the linker directive file (see the linker manual for the proper syntax). Then use a #pragma statement in your code around the data definition to locate that data within the named memory section (see the compiler or linker manual for the proper #pragma statement). – kkrambo Mar 25 '14 at 11:55
-
FlexMemory indeed. The IDE is very limited on pragmas available but it looks like i can use attribute_section. I'm not that familiar with how exactly linker works, so i have one more question if you don't mind. The way FlexMemory module works, is that at very first execution of the code on a chip I have to partition the memory and only then i am able to read/write to it. Will linker attempt to configure anything within the memory, or does it just define sections for the source code to refer to ? many thanks, your answer was quite helpful. – Stani Mar 25 '14 at 17:14
-
I'm not familiar with your microcontroller or FlexMemory so I can't speak to it specifically. In general, the linker locates and populates all the code and data into the address space (for example, code goes in the .text section and constants in the .data section). The linker produces a file representing the contents of the address space. A programming device can read the linker output file and actually program the flash. The programmer device may have to configure the memory but the linker does not do this itself. Perhaps there is a configuration file for your programmer. – kkrambo Mar 25 '14 at 20:01