main
John Lauer
Add reproducible output-locked STM32 USB bring-up build; retain hardware qualification gates
a0235fd
/* Newlib formatting may allocate. Bound its heap independently of the stack. */
#include <sys/types.h>
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
static union { max_align_t alignment; unsigned char bytes[8192]; } heap;
void *_sbrk(ptrdiff_t delta) {
static size_t used;
if (delta < 0 || (size_t)delta > sizeof(heap.bytes) - used) {
errno = ENOMEM; return (void *)-1;
}
void *old = heap.bytes + used; used += (size_t)delta; return old;
}
/* No console/file-system backend is connected. Fail explicitly, never route
* printf through GPIO/UART pins without the board adapter owning them. */
#include <sys/stat.h>
int _close(int fd) { (void)fd; errno=EBADF; return -1; }
int _fstat(int fd, struct stat *st) { (void)fd; (void)st; errno=EBADF; return -1; }
int _isatty(int fd) { (void)fd; return 0; }
off_t _lseek(int fd, off_t offset, int whence) { (void)fd; (void)offset; (void)whence; errno=EBADF; return -1; }
ssize_t _read(int fd, void *buf, size_t len) { (void)fd; (void)buf; (void)len; errno=EBADF; return -1; }
ssize_t _write(int fd, const void *buf, size_t len) { (void)fd; (void)buf; (void)len; errno=EBADF; return -1; }
int _getpid(void) { return 1; }
int _kill(int pid, int sig) { (void)pid; (void)sig; errno=EINVAL; return -1; }
extern void load_fatal(void);
void _exit(int status) { (void)status; load_fatal(); for (;;) {} }