In the processor expert generated linker script, there is section m_cfmprotrom placed specifically at address 0x400. The interrupt section takes up 0x0-0x198 and then the cfmprotrom is placed at 0x400 skipping 0x202 bytes for some reason.
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000198
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
The 0x10 bytes that get put in m_cfmprotrom are defined in CPU_Config.h:
#define CPU_FLASH_CONFIG_FIELD \
/* NV_BACKKEY3: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY2: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY1: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY0: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY7: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY6: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY5: KEY=0xFF */ \
0xFFU, \
/* NV_BACKKEY4: KEY=0xFF */ \
0xFFU, \
/* NV_FPROT3: PROT=0xFF */ \
0xFFU, \
/* NV_FPROT2: PROT=0xFF */ \
0xFFU, \
/* NV_FPROT1: PROT=0xFF */ \
0xFFU, \
/* NV_FPROT0: PROT=0xFF */ \
0xFFU, \
/* NV_FSEC: KEYEN=1,MEEN=3,FSLACC=3,SEC=2 */ \
0x7EU, \
/* NV_FOPT: ??=1,??=1,FAST_INIT=1,??=1,??=1,NMI_DIS=1,EZPORT_DIS=1,LPBOOT=1 */ \
0xFFU, \
/* Reserved */ \
0xFFU, \
/* Reserved */ \
0xFFU
I get what they are for, the keys to unlock each flash section, and some other configuration data, but it appears to never get accessed by any code. Why is it placed in its own section at 0x400 and not somewhere in m_text or m_data? Could anything go wrong if this section is moved away from 0x400 or put into m_text?
Is there a way to edit linker file generation from processor expert?
已解决! 转到解答。
This data must be placed at those specific memory locations. This data is read by the MCU/flash memory controller before any code is executed. The MCU/Flash memory controller is expecting this control data to be at those specific memory locations. Don't move the data. You risk disabling the CPU with no way to recover, if incorrect configuration data is placed at 0x400.
This data must be placed at those specific memory locations. This data is read by the MCU/flash memory controller before any code is executed. The MCU/Flash memory controller is expecting this control data to be at those specific memory locations. Don't move the data. You risk disabling the CPU with no way to recover, if incorrect configuration data is placed at 0x400.