Naming FAQ

Q: What's the meaning of the prefix up_ in NuttX? Which functions should be prefixed with ''up_''?

A: up_ is supposed to stand for microprocessor; the u is like the Greek letter micron: µ. So it would be µP which is a common shortening of the word microprocessor. I don't like that name very much. I wish I would have used arch_ instead. But now I think I am stuck with up_

Here are some general rules:

  • Common Microprocessor Interfaces. Any interface that is common to all microprocessors should be prefixed with up_ and prototyped in include/nuttx/arch.h. The definitions in that header file provide the common interface between NuttX and the architecture-specific implementation in arch/.
  • Microprocessor-Specific Interfaces. An interface which is unique to a certain microprocessor should be prefixed with the name of the microprocessor, for example stm32_, and be prototyped in some header file in the arch/ directories.

There is also a arch/<architecture>/include/<chip>/chip.h header file that can be used to communicate other microprocessor-specific information between the board logic and even application logic. Application logic may, for example, need to know specific capabilities of the chip. Prototypes in that chip.h header file should follow the microprocessor-specific naming convention.

  • Common Board Interfaces. Any interface that is common to all boards should be prefixed with board_ and should also be prototyped in include/nuttx/arch.h. These board_ definitions provide the interface between the board-level logic and the architecture-specific logic.

There is also a configs/<board>/include/board.h header file that can be used to communicate other board-specific information between the architecture logic and even application logic. Any definitions which are common between a single architecture and several boards should go in this board.h header file; include/nuttx/arch.his reserved for board-related definitions common to all architectures.

  • Board-Specific Interfaces. Any interface which is unique to a board should be prefixed with the board name, for example stm32f4discovery_. Sometimes the board name is too long so stm32_ would be okay too. These should be prototyped in configs/<board>/src/<board>.h and should not be used outside of that directory since board-specific definitions have no meaning outside of the board directory.