Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/arm7_common: fix compilation with 12.2.0 #18638

Merged
merged 1 commit into from
Sep 24, 2022

Conversation

maribu
Copy link
Member

@maribu maribu commented Sep 23, 2022

Contribution description

This fixes:

Assembler messages:
Fatal error: unknown option `-ggdb'

Testing procedure

Run with a recent toolchain:

$ make BOARD=msba2 -C examples/hello-world/
With master
$ make BOARD=msba2 -C examples/hello-world/
make: Entering directory '/home/maribu/Repos/software/RIOT/examples/hello-world'
Building application "hello-world" for "msba2" with MCU "lpc23xx".

"make" -C /home/maribu/Repos/software/RIOT/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/boards/msba2
"make" -C /home/maribu/Repos/software/RIOT/core
"make" -C /home/maribu/Repos/software/RIOT/core/lib
"make" -C /home/maribu/Repos/software/RIOT/cpu/lpc23xx
Assembler messages:
Fatal error: unknown option `-ggdb'
make[2]: *** [/home/maribu/Repos/software/RIOT/Makefile.base:176: /home/maribu/Repos/software/RIOT/examples/hello-world/bin/msba2/cpu/asmfunc.o] Error 1
make[1]: *** [/home/maribu/Repos/software/RIOT/Makefile.base:31: ALL--/home/maribu/Repos/software/RIOT/cpu/lpc23xx] Error 2
make: *** [/home/maribu/Repos/software/RIOT/examples/hello-world/../../Makefile.include:738: application_hello-world.module] Error 2
make: Leaving directory '/home/maribu/Repos/software/RIOT/examples/hello-world'
This PR
$  make BOARD=msba2 -C examples/hello-world/
make: Entering directory '/home/maribu/Repos/software/RIOT/examples/hello-world'
Building application "hello-world" for "msba2" with MCU "lpc23xx".

"make" -C /home/maribu/Repos/software/RIOT/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/boards/msba2
"make" -C /home/maribu/Repos/software/RIOT/core
"make" -C /home/maribu/Repos/software/RIOT/core/lib
"make" -C /home/maribu/Repos/software/RIOT/cpu/lpc23xx
"make" -C /home/maribu/Repos/software/RIOT/cpu/arm7_common
"make" -C /home/maribu/Repos/software/RIOT/cpu/arm7_common/periph
"make" -C /home/maribu/Repos/software/RIOT/cpu/lpc23xx/periph
"make" -C /home/maribu/Repos/software/RIOT/drivers
"make" -C /home/maribu/Repos/software/RIOT/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/sys
"make" -C /home/maribu/Repos/software/RIOT/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/sys/bitfield
"make" -C /home/maribu/Repos/software/RIOT/sys/div
"make" -C /home/maribu/Repos/software/RIOT/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/sys/stdio_uart
   text	  data	   bss	   dec	   hex	filename
  12276	   128	  6932	 19336	  4b88	/home/maribu/Repos/software/RIOT/examples/hello-world/bin/msba2/hello-world.elf
make: Leaving directory '/home/maribu/Repos/software/RIOT/examples/hello-world'

Issues/PRs references

None

This fixes:

    Assembler messages:
    Fatal error: unknown option `-ggdb'
@maribu maribu requested a review from kaspar030 as a code owner September 23, 2022 16:43
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Sep 23, 2022
@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: cpu Area: CPU/MCU ports Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … and removed Area: cpu Area: CPU/MCU ports labels Sep 23, 2022
@maribu maribu merged commit d75722b into RIOT-OS:master Sep 24, 2022
@maribu
Copy link
Member Author

maribu commented Sep 24, 2022

Thx :)

@maribu maribu deleted the cpu/arm7_common branch September 24, 2022 11:48
@benpicco
Copy link
Contributor

benpicco commented Sep 24, 2022

It's strange that makefiles/arch/cortexm.inc.mk also has this with apparently no complaints.

(And yea, those flags are arch independent, some de-duplication would probably be a good idea…)

@maribu
Copy link
Member Author

maribu commented Sep 24, 2022

Sadly not, those are indeed to different ISAs. The ARM7 MCUs support the ARM ISA (and have incomplete support for the thumb ISA as well), the Cortex M MCUs do not support the ARM ISA anymore but have full support for the thumb ISA.

I tried to build the ARM7 stuff with -mthumb which mostly worked, but irq_disable() and irq_restore() require the mrs instruction, which only is available in later versions of the thumb ISA. Maybe there are implementations that would work with the early thumb as well. I think that thumb would be beneficial. On all MCUs code density would profit significantly, one MCUs with a 16 bit but the performance would benefit as well.

@benpicco
Copy link
Contributor

I know, but I'm talking about

CFLAGS_LINK = -ffunction-sections -fdata-sections -fshort-enums
CFLAGS_DBG  ?= -ggdb -g3
CFLAGS_OPT  ?= -Os

CFLAGS      += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
ASFLAGS     += $(CFLAGS_CPU) $(CFLAGS_DBG)
LINKFLAGS   += -T$(RIOTCPU)/$(CPU)/ldscripts/$(CPU).ld
LINKFLAGS   += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -nostartfiles
LINKFLAGS   += -Wl,--gc-sections

This is completely arch independent and copy & pasted for each target

@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants