Skip to content

Commit fa1eaed

Browse files
committed
Documented the MXChip Newlib runtime glue
Clarified the boundary between Newlib system calls, the BSP, ThreadX, and the ThreadX POSIX compatibility layer. Assisted-by: Codex (GPT-5) <noreply@openai.com>
1 parent 4ddc8b4 commit fa1eaed

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

MXChip/AZ3166/deps/src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set(TARGET app_common)
1616
# Initialize sources
1717
set(SOURCES "")
1818

19-
# Allow to disable the newlib stubbing
19+
# Add the sample's Newlib system-call glue unless the BSP provides its own.
2020
if(NOT DEFINED DISABLE_NEWLIB_STUB)
2121
list(APPEND SOURCES
2222
newlib_nano.c
@@ -32,4 +32,4 @@ target_link_libraries(${TARGET}
3232
azrtos::netxduo
3333
jsmn
3434
nanoprintf
35-
)
35+
)

MXChip/AZ3166/deps/src/newlib_nano.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) Microsoft
33
* Copyright (c) 2024 Eclipse Foundation
4+
* Copyright (c) 2026 Eclipse ThreadX contributors
45
*
56
* This program and the accompanying materials are made available
67
* under the terms of the MIT license which is available at
@@ -13,6 +14,29 @@
1314
* Frédéric Desbiens - 2024 version.
1415
*/
1516

17+
// Some portions generated by Codex (GPT-5).
18+
19+
/*
20+
* Bare-metal C library integration for the MXChip sample.
21+
*
22+
* Newlib and newlib-nano implement the C library, but delegate services that
23+
* normally come from an operating system to target-provided system calls.
24+
* This file supplies the subset needed by this sample. The board console in
25+
* app/common/console.c supplies _read() and _write() separately.
26+
*
27+
* These functions are not part of ThreadX or its POSIX compatibility layer.
28+
* The exact system calls required by an application depend on the Newlib
29+
* version and configuration, the linker specifications, and the C library
30+
* routines that the application uses.
31+
*
32+
* Several functions below are minimal stubs because the sample has no file
33+
* system or process model. The _sbrk() implementation is also sample-specific:
34+
* it starts the C library heap at the linker-defined _end symbol, has no upper
35+
* bound, and provides no synchronization. Applications that allocate from
36+
* multiple threads, use a different memory layout, or require the unsupported
37+
* services must provide suitable replacements in their BSP.
38+
*/
39+
1640
#ifdef __GNUC__
1741

1842
#include <stdio.h>

0 commit comments

Comments
 (0)