Build

Build Process Overview

XWOS uses its own Build System for building. The build starts from the board directory by executing the make command. This directory is represented as $(XWOS_BRD_DIR). In short, the build process compiles each module into a static library .a, which are then linked into an ELF file.

  • arch.a: compiled as described by arch.mk;
  • cpu.a: compiled as described by cpu.mk;
  • soc.a: compiled as described by soc.mk;
  • brd.a: compiled as described by brd.mk;
  • xwos.a: compiled as described by xwos.mk;
  • Other modules are compiled as described by xwmo.mk, referred to as the Build System, including:
    • xwcd: Driver module
    • xwmd: Middleware module
    • xwem: Third-party software module
    • xwam: Example and application module
    • $(XWOS_BRD_DIR)/bm: Board module
      • $(XWOS_BRD_DIR) is the board directory.
    • $(XWOS_OEM_DIR): OEM module
      • XWOS_OEM_DIR is configured by XWCFG_OEMPATH in the configuration file $(XWOS_BRD_DIR)/cfg/project.mk.

Output File Path

All build output is located in the $(WKSPC) directory. The default value is defined in $(XWOS_BRD_DIR)/makefile as wkspc.

This variable can be set by the user before building, for example:

export WKSPC=../../../Debug

After building, the directory $(XWOS_BRD_DIR)/../../../Debug will be automatically created, and all intermediate build files will be placed there.

Viewing the Build Process

Users can view the complete build process by using make V=1. An environment variable can also be used:

export V=1
make

Setting Optimization Level

Users can set the optimization level to 1 during compilation by using make O=1. An environment variable can also be used:

export O=0 # No optimization, best for debugging
make

By default, the optimization level is g.