Assembly error with the SVC instruction not supported #253

Closed
opened 2021-03-13 07:18:29 -06:00 by dcabanis · 2 comments
dcabanis commented 2021-03-13 07:18:29 -06:00 (Migrated from github.com)

The SCV instructions is optionally implemented in some of the Cortex-M0+ (synthesis option) consequently the arm_none_eabi_gcc has to target options one including the SVC instruction: -march=armv6s-m and one without it: -march=armv6-m. As far as I can see the makefile uses -march=armv6-m by default thereby causing the fault: "context_switch.s:163: Error: SVC is not permitted on this architecture".

the toolchain configuration provided in the pico-sdk. if you navigate to the file: pico-sdk/cmake/preload/toolchains/pico_arm_gcc.cmake around the line 55 you will find:

set(ARM_GCC_COMMON_FLAGS " -march=armv6-m -mcpu=cortex-m0plus -mthumb")

This is incorrect; The rp2040 implementation of the Cortex-M0+ includes the SVC instruction. This architecture doesn't. You will need to change the line to the following one:

set(ARM_GCC_COMMON_FLAGS " -march=armv6s-m -mcpu=cortex-m0plus -mthumb")

The SCV instructions is optionally implemented in some of the Cortex-M0+ (synthesis option) consequently the arm_none_eabi_gcc has to target options one including the SVC instruction: -march=armv6s-m and one without it: -march=armv6-m. As far as I can see the makefile uses -march=armv6-m by default thereby causing the fault: "context_switch.s:163: Error: SVC is not permitted on this architecture". the toolchain configuration provided in the pico-sdk. if you navigate to the file: pico-sdk/cmake/preload/toolchains/pico_arm_gcc.cmake around the line 55 you will find: set(ARM_GCC_COMMON_FLAGS " -march=armv6-m -mcpu=cortex-m0plus -mthumb") This is incorrect; The rp2040 implementation of the Cortex-M0+ includes the SVC instruction. This architecture doesn't. You will need to change the line to the following one: set(ARM_GCC_COMMON_FLAGS " -march=armv6s-m -mcpu=cortex-m0plus -mthumb")
lurch commented 2021-03-13 08:16:39 -06:00 (Migrated from github.com)

Is this relevant? https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu
(although it's focused at the HPC end of the spectrum rather than the embedded end!) It says:

Compiling for Arm

TL;DR: Whenever possible use only -mcpu=native. Avoid -march and -mtune.

Does that work for your use-case @dcabanis ? (i.e. does it work if you remove the -march option)

Is this relevant? https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu (although it's focused at the HPC end of the spectrum rather than the embedded end!) It says: ### Compiling for Arm **TL;DR: Whenever possible use only -mcpu=native. Avoid -march and -mtune.** Does that work for your use-case @dcabanis ? (i.e. does it work if you remove the `-march` option)
Wren6991 commented 2021-03-17 13:06:33 -05:00 (Migrated from github.com)

Fixed by #260

Fixed by #260
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#253
No description provided.