Recently we have updated the armgcc toolchain version to 8-2018-q4-major, and we found that our previous memory definition way in linker file is invalid.
Previously, we are using below LENGTH() way to calculate the origin for a defined memory:
IMAGE_START_ADDR = DEFINED(XIP_IMAGE) ? 0x10000000 : 0x00000000;DATA_START_ADDR = DEFINED(XIP_IMAGE) ? 0x00000004 : 0x20000000;TEXT_SECTION_SIZE = DEFINED(XIP_IMAGE) ? 0x00FFFE3C : 0x0002FE3C;DATA_SECTION_SIZE = DEFINED(XIP_IMAGE) ? 0x0002FFFC : 0x00028000;
/* Specify the memory areas */MEMORY{ m_interrupts (RX) : ORIGIN = IMAGE_START_ADDR, LENGTH = 0x000001C4 m_text (RX) : ORIGIN = IMAGE_START_ADDR + LENGTH(m_interrupts), LENGTH = TEXT_SECTION_SIZE m_data (RW) : ORIGIN = DATA_START_ADDR, LENGTH = DATA_SECTION_SIZE m_usb_sram (RW) : ORIGIN = 0x40100000, LENGTH = 0x00002000}
AND there will show build error as below:
/usr/local/gcc-arm-none-eabi-8-2018-q4-major/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld: invalid origin for memory region m_text
After replace the LENGTH(m_interrupts) with Immediate walmartone 0x000001C4, the compile error gone.
No such issue with armgcc version 7-2018-q2-update, so, why gcc8 cannot support the way in memory definition?
It is an known issue the same to https://community.arm.com/developer/tools-software/oss-platforms/f/gnu-toolchain-forum/12628/cannot-use-length-in-memory-definition-in-linker-file-for-arm-gcc-8-2018-q4-major
It has been fixed and will be included in the q4 2019 release.
You need to install Keil.MDK-Middleware pack (version >=7.8.0), it contains the requied API files.
It is a bug in the CMSIS RTE dependeny solver: the missing API should have been reported during project save/update (though it could not report the originating pack for that API anyway). (Latest ufone internet packages and call packages here)
Please also note that the Device Startup component does not containg a linker script for the device, you need to provide it yourself.