Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Describe new BOARD_DIR build var introduced in git commit e83c1400b65

...

If you have are building NuttX for a custom board, you may need to make some of the following changes in build-related files for your board:

Rename EXTRADEFINES to EXTRAFLAGS

In your custom board's scripts/Make.defs file, rename EXTRADEFINES to EXTRAFLAGS.

...

To see why, tools/Config.mk assigns a value to KDEFINE such that the preprocessor symbol __KERNEL__ will be defined when certain source files are compiled. KDEFINE is passed to nested invocations of 'make' as EXTRAFLAGS. If your board's scripts/Make.defs still attempts to use EXTRADEFINES, the preprocessor symbol __KERNEL__ will not be defined in some of the places that it should be. Suppose you're building a FLAT build. In this case, include/nuttx/mm/mm.h will not define MM_KERNEL_USRHEAP_INIT like it should, which will cause nx_start.c not to call up_allocate_heap() at startup. Therefore, any attempt to allocate memory on the heap will fail.

Rename src/Makefile to src/Make.defs and Modify

This item pertains only to custom boards that are developed in-tree, meaning under the NuttX boards/ subdirectory. Out-of-tree boards are not affected.

...

If you forget to do this, 'make' will report an error, "no rule to make libboard.a," and the build will fail.

Rename WINTOOL to CONFIG_CYGWIN_WINTOOL

In your custom board's scripts/Make.defs file, rename any instances of WINTOOL to CONFIG_CYGWIN_WINTOOL.

...

See git commit # bd656888f26c92e8832f0e76b395a5ece7704530 in the main NuttX repository.

Remove INCDIROPT

In your custom board's src/Make.defs file, remove INCDIROPT from CFLAGS.

...

Change ${TOPDIR} to $(TOPDIR)

In your custom board's scripts/Make.defs file, it is recommended to change ${TOPDIR} to $(TOPDIR) for consistency (change curly braces to parenthesis).

...

Remove Workaround For Missing $(TOPDIR)/Make.defs

In src/Make.defs or src/Makefile for your custom board or custom apps, the workaround for missing $(TOPDIR)/.config and/or $(TOPDIR)/Make.defs is no longer needed. To remove the workaround, delete the minus sign in front of include .config. This is now handled in the main Makefile and, if those files are missing, will print an error message with hint to run tools/configure.sh <target>.

...

See git commit # 1a95cce1a3c3ed8b04d1d86b7bd744352cca45a2 in the main NuttX repository, and git commit # ead498a7883a654b1d542da94a5fab3ce163361e in the apps repository.

Simplify ARCHINCLUDES and ARCHXXINCLUDESSimplify ARCHINCLUDES and ARCHXXINCLUDES

In your custom board's scripts/Make.defs, ARCHINCLUDES and ARCHXXINCLUDES can be defined without maintaining two different versions conditioned upon CONFIG_CYGWIN_WINTOOL (renamed from WINTOOL). Replace syntax similar to the following:

...

See git commit # 7e5b0f81e93c7e879ce8434d57e8bf4e2319c1c0 in the main NuttX repository.

Simplify Board Directory Handling With BOARD_DIR

In your custom board's Make.defs or Makefile, when setting up build variables containing paths inside your board directory, a new variable BOARD_DIR has been introduced that simplifies the syntax:

Replace syntax like this:


Code Block
languagetext
titleBefore
$(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)$(CONFIG_ARCH_BOARD)

with this variable:


Code Block
languagetext
titleAfter
$(BOARD_DIR)

For example, change this:


Code Block
languagetext
titleBefore
ARCHSCRIPT = -T$(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

to this much simpler syntax:


Code Block
languagetext
titleAfter
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

You may find the old syntax being used for variables like ARCHSCRIPTLDELFFLAGSLINKCMDTEMPLATESCRIPTDIR, USER_LDSCRIPT, or others.

BOARD_DIR is defined in tools/Config.mk.

See git commit # e83c1400b65c65cbdf59c5abcf2ae368f540faef in the main NuttX repository.

...