API Overview

Complete reference for NitroCortex framework APIs

API Design Principles

The NitroCortex API follows consistent design principles across all components:

Return Codes

CodeValueDescription
NT_OK0Operation successful
NT_ERROR-1Generic error
NT_TIMEOUT-2Operation timed out
NT_NOMEM-3Out of memory
NT_INVALID-4Invalid parameter
NT_BUSY-5Resource busy

NitroOS API

OS
Real-Time Operating System
Thread management, synchronization, memory pools, timers

Task Management

NT_TaskCreate() NitroOS

NT_STATUS NT_TaskCreate(NT_TASK* task, const char* name, void (*entry)(void*), void* arg, uint32_t stack_size, uint8_t priority)

Creates a new task with the specified entry point, stack size, and priority (0-31, higher = more priority).

NT_TaskDelay() NitroOS

void NT_TaskDelay(uint32_t ticks)

Suspends the current task for the specified number of system ticks.

NT_TaskYield() NitroOS

void NT_TaskYield(void)

Yields execution to another ready task of equal or higher priority.

Synchronization

NT_MutexCreate() NitroOS

NT_STATUS NT_MutexCreate(NT_MUTEX* mutex, const char* name)

Creates a mutex with priority inheritance support.

NT_MutexLock() NitroOS

NT_STATUS NT_MutexLock(NT_MUTEX* mutex, uint32_t timeout)

Acquires the mutex, blocking until available or timeout expires.

NT_SemCreate() NitroOS

NT_STATUS NT_SemCreate(NT_SEM* sem, const char* name, uint32_t initial_count)

Creates a counting semaphore with the specified initial count.

NitroFS API

FS
Embedded File System
stdio-compatible file operations, FAT/exFAT support

File Operations

NF_FOpen() NitroFS

NF_FILE* NF_FOpen(const char* path, const char* mode)

Opens a file with stdio-compatible mode string ("r", "w", "a", "rb", "wb", etc.).

NF_FRead() NitroFS

size_t NF_FRead(void* buffer, size_t size, size_t count, NF_FILE* file)

Reads data from file into buffer. Returns number of items read.

NF_FWrite() NitroFS

size_t NF_FWrite(const void* buffer, size_t size, size_t count, NF_FILE* file)

Writes data from buffer to file. Returns number of items written.

NitroSIM API

SIM
ARM Cortex-M Emulator
CPU emulation, debugging, peripheral simulation

NS_Init() NitroSIM

NS_STATUS NS_Init(NS_CONFIG* config)

Initializes the emulator with target configuration (core type, memory map, peripherals).

NS_LoadELF() NitroSIM

NS_STATUS NS_LoadELF(const char* path)

Loads an ELF executable into emulator memory.

NS_Run() NitroSIM

NS_STATUS NS_Run(uint64_t cycles)

Executes the specified number of CPU cycles, or until breakpoint/halt.

NitroVISION API

TUI
TUI Framework
Windows, dialogs, menus, widgets

NV_Init() NitroVISION

NV_STATUS NV_Init(NV_CONSOLE console)

Initializes the TUI system with the specified console (UART, VT100, etc.).

NV_CreateWindow() NitroVISION

NV_WINDOW* NV_CreateWindow(const char* title, int x, int y, int width, int height)

Creates a new window with title bar, border, and optional close button.

NV_AddButton() NitroVISION

NV_BUTTON* NV_AddButton(NV_WINDOW* parent, const char* label, int x, int y, NV_CALLBACK onClick)

Adds a clickable button widget to a window.

Next Steps