Skip to content

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).

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
@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