Hi!
I'm trying to declare variables in my code that will be used when accessing my external EEPROM. My plan was to place these variables inside a section in some .c file and then place this section in a memory segment in the Link Control File. This segment of course has to start from the beginning of the EEPROM, address 0. My problem is that I can’t find out how to do this in the Link Control File. I don’t even know if it’s possible!? Anyone having some ideas how to do this?
I think you want to have your SPI EEPROM memory mapped in order to access there the same way as internal flash for instance. It is not possible with DSPI module, it is only possible with devices having QSPI module (MPC5606S and MPC5645S).
Generally you can define your own segment and sections in linker command file, but still only for memory mapped memories (internal sram or internal flash, or external bus for devices having EBI what’s not the case of MPC5602B).
Thank's for the fast answer!!
My hope was that it should be possible to do somewhat that I did for the MC9S08QE8 (se example below, red text), but if I understand you right this is not possible to do for MPC5602 using IDE CW for MCU v10.6.
.prm file
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
Z_RAM = READ_WRITE 0x0060 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x025F;
ROM = READ_ONLY 0xE000 TO 0xFFAD;
ROM1 = READ_ONLY 0xFFC0 TO 0xFFCD;
EXTERNAL_EEPROM = PAGED 0x0 TO 0x7FF;
END
PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
DEFAULT_RAM /* non-zero page variables */
INTO RAM;
_PRESTART, /* startup code */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
FUNC_PTR_SEG, /* state machine function pointers */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
DEFAULT_ROM,
COPY /* copy down information: how to initialize variables */
INTO ROM; /* ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler */
_DATA_ZEROPAGE, /* zero page variables */
MY_ZEROPAGE INTO Z_RAM;
EEPROM INTO EXTERNAL_EEPROM;
END
.c file
/* Global variables */
#pragma CONST_SEG EEPROM
const word eeConfigured;
const tCnfDataRead eeDec1Config;
const tCnfDataRead eeDec2Config;
const tJointCntrErrors eeJointErrors;
const word eeSerialNbr;
const byte eeUnitConfigured;
const tOffsStruct eeDacOffsets;
const tCalibStructs eeCalibValues;
#pragma CONST_SEG DEFAULT