一键导入
add-userbdos-program
Create a new userBDOS program (user-space application for BDOS). Use when asked to write a new program, app, tool, or utility for the FPGC.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new userBDOS program (user-space application for BDOS). Use when asked to write a new program, app, tool, or utility for the FPGC.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Debug hardware issues on FPGC: SPI devices, DMA transfers, SD card, Ethernet, USB. Use when asked to debug a hardware problem, add debug output, or diagnose a peripheral issue.
Add a new shell built-in command to BDOS. Use when asked to add a shell command, built-in, or CLI command.
Add a new syscall to BDOS and expose it to userland programs. Use when asked to add a system call, kernel API, or new OS functionality accessible from user programs.
Update documentation after making code or hardware changes. Use when asked to update docs, write documentation, or after completing a feature that needs documenting.
基于 SOC 职业分类
| name | add-userbdos-program |
| description | Create a new userBDOS program (user-space application for BDOS). Use when asked to write a new program, app, tool, or utility for the FPGC. |
Create Software/C/userBDOS/YOURPROGRAM.c:
/*
* YOURPROGRAM — brief description
*
* Usage: YOURPROGRAM [args]
*/
// Standard includes for userBDOS programs
#include <syscall.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
// argc/argv are provided by the shell via syscalls
// Use syscall wrappers for all OS interaction:
// open(), read(), write(), close(), lseek()
// mkdir(), unlink(), readdir()
// malloc(), delay(), exit()
return 0;
}
make compile-userbdos file=YOURPROGRAM
This produces a flat binary that can be uploaded to the FPGC.
make run-userbdos file=YOURPROGRAM [dev=N] # Compile + upload + run
make fnp-upload-userbdos file=YOURPROGRAM # Just upload
make fnp-debug-userbdos file=YOURPROGRAM # Upload + run + UART capture
int fd = open("/path/to/file", O_RDONLY);
int n = read(fd, buf, sizeof(buf));
write(fd, buf, n);
lseek(fd, 0, SEEK_SET);
close(fd);
Flags: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND
mkdir("/path/to/dir");
unlink("/path/to/file");
readdir("/path", entries_buf, max_entries);
void *p = malloc(size); // Kernel heap allocation (no free!)
// Write to stdout (fd 1) — goes to the terminal
write(1, "Hello\n", 6);
// Or use stdlib helpers if available
// Read from stdin (fd 0)
char c;
read(0, &c, 1);
free() — allocated memory is released when the program exitsprintf — use write(1, ...) or stdlib string helpers/ for SPI flash root, /sdcard/ for SD cardStudy Software/C/userBDOS/tree.c for a clean example with file I/O
and argument handling.