Build errors after using ModusToolbox™ BSP Assistant – KBA236587
Community Translation: ModusToolbox™ BSP アシスタントを使用した後のビルドエラー – KBA236587
Question: Why am I getting build errors with my ModusToolbox™ application after using the BSP Assistant? For example:
proj_cm0p.elf section '.text' will not fit in region 'flash'
ld.exe: region 'flash' overflowed by 8500 bytes
#error "Unhandled Device/PinPackage combination"
Answer: These types of errors occur mostly with multi-core code examples that include custom linker scripts, start-up code, and bsp configuration files. When changing devices using the BSP Assistant, the tool creates a backup of the custom files, and then replaces them with default files for the selected device. The BSP Assistant displays warnings such as:
WARNING:[PATH]/bsps/TARGET_APP_CY8CPROTO-062S3-4343W/COMPONENT_CM0P/TOOLCHAIN_GCC_ARM/linker.ld had local edits. A backup was placed in [PATH]/bsps/TARGET_APP_CY8CPROTO-062S3-4343W/COMPONENT_CM0P/TOOLCHAIN_GCC_ARM/linker.ld.bak.
WARNING:[PATH]/bsps/TARGET_APP_CY8CPROTO-062S3-4343W/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/linker.ld had local edits. A backup was placed in [PATH]/bsps/TARGET_APP_CY8CPROTO-062S3-4343W/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/linker.ld.bak.
The BSP Assistant provides a list of files changed/added, as well as a diff tool to see the changes made. For more details, refer to the BSP Assistant user guide.
Adjust flash size
One issue is that multi-core code examples need to allocate more flash for the CM0p image, so they include custom linker scripts. The default linker scripts shipped with the BSP are not designed for multi-core designs, and they have insufficient flash allocated to the CM0p for doing anything meaningful. Since the BSP Assistant replaces the custom linker scripts, the build fails. To resolve this issue:
- In the CM0p linker script, change the flash size to a minimum of 0x4400. Check the value in the .bak file to be sure.
- In the CM4 linker script, change the FLASH_CM0P_SIZE to match the value set in the CM0p linker script.
- In the CM0p project Makefile, adjust the start address of the CM4 image by setting/updating the CY_CORTEX_M4_APPL_ADDR define.
For other errors, compare the files named *.bak with the new files that replaced them, and make the appropriate changes to resolve the build errors.