HomeCore 0.1.3 (07b5544)
Bare-metal personal computer firmware for Cortex-M
Loading...
Searching...
No Matches

Board-specific clock policy, pin wiring, console, and panic output. More...

Collaboration diagram for Board support:

Macros

#define BOARD_STRINGIFY(x)   #x
 Stringify x without macro-expanding it first.
 
#define BOARD   DT_BOARD_NAME
 Board name string from board.yaml, such as "STM32VLDISCOVERY".
 

Functions

void board_init (void)
 Initialize board clocks, pins, and the console UART.
 
uint32_t board_cpu_clock_hz (void)
 Report the core clock frequency.
 
void board_uart_putc (char c)
 Write one byte to the console UART by polling.
 
int board_uart_getc (void)
 Read one byte from the console UART, blocking until one arrives.
 
int board_uart_has_data (void)
 Check without blocking whether the console UART has received data.
 
void board_panic (const char *msg)
 Report a fatal error and halt.
 

Detailed Description

Board-specific clock policy, pin wiring, console, and panic output.

Each board implements board_init(), board_cpu_clock_hz(), and board_panic() in src/board/<name>/board.c, and describes its hardware in board.yaml. The board_uart_* functions are implemented once, in src/drivers/console.c, on the console chosen by the description.

Function Documentation

◆ board_init()

void board_init ( void  )

Initialize board clocks, pins, and the console UART.

main() calls it once, after soc_init() and before k_init(). The board may call board_panic() if clock setup fails.

◆ board_cpu_clock_hz()

uint32_t board_cpu_clock_hz ( void  )

Report the core clock frequency.

Returns
Core clock in Hz, which also drives the system timer. It must match the clock configured by board_init().

◆ board_uart_putc()

void board_uart_putc ( char  c)

Write one byte to the console UART by polling.

May block indefinitely. Call from foreground code or the fatal panic path.

Parameters
cByte to transmit.

◆ board_uart_getc()

int board_uart_getc ( void  )

Read one byte from the console UART, blocking until one arrives.

Call from foreground code only. There is no end-of-file condition.

Returns
Received byte in the range 0 to 255.

◆ board_uart_has_data()

int board_uart_has_data ( void  )

Check without blocking whether the console UART has received data.

Precondition
board_init() has run.
Returns
Nonzero if a byte is available, otherwise 0.

◆ board_panic()

void board_panic ( const char *  msg)

Report a fatal error and halt.

Callable from fault handlers. Output is best effort: an early fault may halt silently if the console is not yet initialized. Does not return on hardware.

Parameters
msgNUL-terminated message. The pointer is not retained.