Troubleshooting
Missing Dependencies for Build
Files added using the GNU assembler syntax .incbin
or .include
directives, or armasm syntax INCBIN
, INCLUDE
, or GET
directives, are not included in the file dependency list. As such, the CMake/Ninja build system cannot trigger automatically a build when an file changes that is included with such directives.
Using execute
in the related cproject.yml
file overcomes this issue.
In this example the file image.bin
is included using assembler syntax. The touch
command changes the time stamp of the related assembler file which triggers a rebuild.
executes:
- execute: image_dep
run: ${CMAKE_COMMAND} -E touch $output$
input:
- image.bin
output:
- asm.s
Tip
Use the images:
node to add the output of external builds.
Common Linker Problems
The following section explains how to fix common linker problems.
Error: L6236E: No section matches selector - no section to be FIRST/LAST
Some devices (for example, the NXP RT1064) use custom (non-CMSIS) assembly startup code. This is not compatible with the default linker script that assumes C Startup code with standard CMSIS definitions.
This problem can be solved by:
- Using the linker script provided by the device vendor.
- Change the linker script source file
ac6_linker_script.sct.src
that is local in your project, for example, as shown below:
ER_ROM0 __ROM0_BASE __ROM0_SIZE {
*(.isr_vector, +First)
*(InRoot$$Sections)
*(+RO +XO)
}
Using RAM1 .. RAM3 Areas
Currently, there is a problem with the default AC6 linker script template. It does not use, by default, the RAM1 .. RAM3 area.
A potential solution is discussed under issue #1778. The investigation is currently ongoing.
Duplicate Heap definition in Assembler startup file
When using memory allocation functions (i.e. malloc
), the application ends in a hard fault handler. This is typically caused by different methods of stack and heap definitions.
The Arm Compiler offers three ways to configure stack and heap. Only one of the following methods should be used:
- Use a linker scatter file to define
ARM_LIB_STACKHEAP
,ARM_LIB_STACK
, orARM_LIB_HEAP
regions. - Use the symbols
__initial_sp
,__heap_base
, and__heap_limit
. - Implement
__user_setup_stackheap()
or__user_initial_stackheap()
.
The C startup code recommended by CMSIS Version 6 uses the linker scatter file for stack and heap definition. The C startup code is generic and works across all toolchains that are supported by the CMSIS-Toolbox.
However, some assembler startup files define stack and heap with other methods, for example, by using the symbols __initial_sp
, __heap_base
, and __heap_limit
.
There are two options to solve the problem.
-
Remove the stack and heap definition in the assembler startup code.
-
Disable in the Regions Header File the stack and heap definition by setting
__STACK_SIZE
and__HEAP_SIZE
to 0 as shown below. This removes the definition in the linker scatter file.
// <h> Stack / Heap Configuration
// <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
// <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
#define __STACK_SIZE 0x00000000
#define __HEAP_SIZE 0x00000000
// </h>
GNU loader issues with Arm Compiler 6
The GNU loader that is used in some GDB Server implementations has issues with *.axf
files that are generated by the Arm Compiler 6.
Specify DWARF5 Format
With DWARF-4 format, the GNU loader may issue warnings such as:
warning: (Internal error: pc 0x8000914 in read in CU, but not in symtab.)
To solve this problem, change to DWARF-5 format. The format is typically specified in the cdefault.yml
file. You may create a local copy of this file in the same directory as the *.csolution.yml
file.
default:
misc:
- for-compiler: AC6
C-CPP:
:
- -gdwarf-5
ASM:
- -masm=auto
- -gdwarf-5
Generate HEX file
While AC6 generates valid ELF files, GDB may be incorrectly load the content. To bypass this problem, generate also an type: hex
file using the output:
node in the *.cproject.yml
file and use this HEX file to load the content.
Example:
project:
:
:
output:
type:
- elf
- hex # create HEX file to bypass GDB loader problem with AC6
- map # create MAP file (optional)
When a type: hex
file is generated for AC6, the CMSIS-Toolbox configures this file in the *.cbuild-run.yml
file with load: image
and the type: elf
file with load: symbols
. This bypasses the GDB loader issue.
Layer Search Fails
The cbuild setup
command does not find compatible layers.
>cbuild setup xxx.csolution.yml
error csolution: undefined variables in xxx.csolution.yml:
- $SDS-Layer$
The layer search of cbuild setup
requires that the packs are defined in the xxx.csolution.yml
file. Ensure that the packs that define compatible layers are part of the software packs list, for example:
solution:
# This is a CMSIS-Toolbox Reference Application that requires a compatible board layer
# Refer to https://open-cmsis-pack.github.io/cmsis-toolbox/ReferenceApplications/ for more information
packs:
- pack: ARM::SDS # search SDS pack for layers