Trouble to locate data section in flash (STM32F207)
Hi,
I attempt to locate information about the firmware in flash. To do so, the data are stored in a dedicated section (called CONTROL_UNIT_SECTION):
/** @brief Definition of the firmware info. */
typedef struct firmware_info_t {
uint8_t id; /**< Identifier of the control unit. */
uint8_t major; /**< Major version number. */
uint8_t minor; /**< Minor version number. */
uint8_t rc; /**< Release candidate number, 0 if production release. */
} FirmwareInfo;
/* Declare the sections in flash that stores the core configuration. */
#pragma section = "CONTROL_UNIT_SECTION"
#pragma location = "CONTROL_UNIT_SECTION"
static const FirmwareInfo firmware_info = {
CONTROL_UNIT_ID,
FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR,
DEVELOPMENT_VERSION
};This section is then located in ROM, using the following statements in the linker file :
define symbol _CU_INFO_REGION_START_ = 0x0803FFF0;
define symbol _CU_INFO_REGION_END_ = 0x0803FFFB;
define region CU_INFO_region = mem:[from _CU_INFO_REGION_START_ to _CU_INFO_REGION_END_ ];
place in CU_INFO_region { readonly section CONTROL_UNIT_SECTION };This is used in 2 different projects with the same target (STM32F207VC) and with the same linker file. In one of the projects, the data are not available at the expected location. In the map file, I can find this :
No sections matched the following patterns:
ro section CONTROL_UNIT_SECTION in "P2"Did I proceed in a wrong way ? What could be the reason of such different behaviors between the projects ?
