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

codal_port/Makefile: Keep C/C++ flags set up by MicroPython lib. #210

Merged
merged 1 commit into from
May 20, 2024

Conversation

microbit-carlos
Copy link
Contributor

@microbit-carlos microbit-carlos commented May 9, 2024

This to be able to create C/C++ modules without modifying files in this repository, as shown in https://github.com/microbit-foundation/micropython-cpp-module-example.

Comparing the flags used before and after this patch:

  • The flags generated in the built CMake output files are the same, as those are managed by the CODAL build system
  • In the MicroPython c files, the only difference was the addition of -DFFCONF_H=\"lib/oofatfs/ffconf.h\" define
  • The makeqstrdefs.py invocation added more flags with the CODAL include paths, my assumption being that this probably won't matter that much if it's only for the qstr generation

The makeqstrdefs.py extra flags added:

-I. -I../codal_app -I../../lib -I../../lib/codal/libraries/codal-nrf52/inc/cmsis -I../../lib/codal/libraries/codal-nrf52/nrfx -I../../lib/codal/libraries/codal-nrf52/nrfx/drivers/include -I../../lib/codal/libraries/codal-nrf52/nrfx/hal -I../../lib/codal/libraries/codal-nrf52/nrfx/mdk -I../../lib/micropython -I../../lib/micropython/ports/nrf

@dpgeorge
Copy link
Collaborator

This change looks good to me. This is how we do it in MicroPython itself (use += for most Makefile variables).

@@ -45,7 +45,8 @@ INC += -I$(BUILD)
CWARN = -Wall -Werror
CWARN += -Wpointer-arith -Wuninitialized
CFLAGS_ARCH += -DNRF52833_XXAA
CFLAGS = $(INC) $(CWARN) -std=c99 $(CFLAGS_MOD) $(CFLAGS_ARCH) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += $(INC) $(CWARN) -std=c99 $(CFLAGS_MOD) $(CFLAGS_ARCH) $(COPT) $(CFLAGS_EXTRA)
CXXFLAGS += $(filter-out -std=c99,$(CFLAGS))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed a space between , and $(CFLAGS), because it's not needed and space means something in Makefile's.

@dpgeorge dpgeorge merged commit 41245c8 into master May 20, 2024
6 checks passed
@dpgeorge dpgeorge deleted the make-flags branch May 20, 2024 04:57
@dpgeorge
Copy link
Collaborator

This to be able to create C/C++ modules without modifying files in this repository

That's a good example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants