diff --git a/compile_commands.json b/compile_commands.json new file mode 100644 index 00000000..b55bb89d --- /dev/null +++ b/compile_commands.json @@ -0,0 +1,1430 @@ +[ + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/system/stubs.cpp.o", + "src/system/stubs.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/stubs.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/stream_buffer.c.o", + "src/rtos/stream_buffer.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/stream_buffer.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/queue.c.o", + "src/rtos/queue.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/queue.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/common/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/common/gid.c.o", + "src/common/gid.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/common/gid.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/timers.c.o", + "src/rtos/timers.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/timers.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/common/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/common/set.c.o", + "src/common/set.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/common/set.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/port.c.o", + "src/rtos/port.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/port.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/dev/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/dev/file_system_stubs.c.o", + "src/system/dev/file_system_stubs.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/dev/file_system_stubs.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/dev/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/dev/vfs.c.o", + "src/system/dev/vfs.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/dev/vfs.c" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/devices/battery.cpp.o", + "src/devices/battery.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/battery.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/hot.c.o", + "src/system/hot.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/hot.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/dev/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/dev/ser_daemon.c.o", + "src/system/dev/ser_daemon.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/dev/ser_daemon.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/heap_4.c.o", + "src/rtos/heap_4.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/heap_4.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/common/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/common/linkedlist.c.o", + "src/common/linkedlist.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/common/linkedlist.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/common/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/common/cobs.c.o", + "src/common/cobs.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/common/cobs.c" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/rtos/rtos.cpp.o", + "src/rtos/rtos.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/rtos.cpp" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/devices/screen.cpp.o", + "src/devices/screen.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/screen.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/unwind.c.o", + "src/system/unwind.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/unwind.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/devices/battery.c.o", + "src/devices/battery.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/battery.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/semphr.c.o", + "src/rtos/semphr.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/semphr.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/devices/vdml_usd.c.o", + "src/devices/vdml_usd.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/vdml_usd.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/task_notify_when_deleting.c.o", + "src/rtos/task_notify_when_deleting.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/task_notify_when_deleting.c" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/./", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/main.cpp.o", + "src/main.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/main.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/user_functions.c.o", + "src/system/user_functions.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/user_functions.c" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/system/cpp_support.cpp.o", + "src/system/cpp_support.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/cpp_support.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/mlock.c.o", + "src/system/mlock.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/mlock.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/dev/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/dev/usd_driver.c.o", + "src/system/dev/usd_driver.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/dev/usd_driver.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/system_daemon.c.o", + "src/system/system_daemon.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/system_daemon.c" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/devices/competition.cpp.o", + "src/devices/competition.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/competition.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/dev/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/dev/ser_driver.c.o", + "src/system/dev/ser_driver.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/dev/ser_driver.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/rtos_hooks.c.o", + "src/system/rtos_hooks.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/rtos_hooks.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/devices/vdml.c.o", + "src/devices/vdml.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/vdml.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/list.c.o", + "src/rtos/list.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/list.c" + }, + { + "arguments": [ + "clang++", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb/v7-a+simd/hard", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include/c++/13.3.1/backward", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu++23", + "-o", + "bin/system/startup.cpp.o", + "src/system/startup.cpp" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/startup.cpp" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/common/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/common/string.c.o", + "src/common/string.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/common/string.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/devices/screen.c.o", + "src/devices/screen.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/screen.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/system/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/system/envlock.c.o", + "src/system/envlock.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/system/envlock.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/devices/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/devices/registry.c.o", + "src/devices/registry.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/devices/registry.c" + }, + { + "arguments": [ + "clang", + "-c", + "-target", + "armv7ar-none-none-eabi", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/include-fixed", + "-isystem/arm-none-eabi-toolchain/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/include", + "-iquote./include", + "-iquote./firmware/libv5rt/sdk/vexv5/patched_include", + "-iquote./include/rtos/", + "-mcpu=cortex-a9", + "-mfpu=neon-fp16", + "-mfloat-abi=hard", + "-Os", + "-g", + "-D_POSIX_THREADS", + "-D_UNIX98_THREAD_MUTEX_ATTRIBUTES", + "-D_POSIX_TIMERS", + "-D_POSIX_MONOTONIC_CLOCK", + "-Wall", + "-Wpedantic", + "-Wno-psabi", + "-ffunction-sections", + "-fdata-sections", + "-fdiagnostics-color", + "-funwind-tables", + "--std=gnu2x", + "-o", + "bin/rtos/tasks.c.o", + "src/rtos/tasks.c" + ], + "directory": "/workspaces/ZestCode", + "file": "src/rtos/tasks.c" + } +] \ No newline at end of file diff --git a/include/system/dev/dev.h b/include/system/dev/dev.h deleted file mode 100644 index 112effa5..00000000 --- a/include/system/dev/dev.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * \file system/dev/dev.h - * - * Generic Serial Device driver header - * - * \copyright Copyright (c) 2017-2024, Purdue University ACM SIGBots. - * All rights reserved. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#pragma once - -#include "vfs.h" - -extern const struct fs_driver* const dev_driver; -int dev_open_r(struct _reent* r, const char* path, int flags, int mode); -void dev_initialize(void); diff --git a/include/system/dev/banners.h b/include/system/vfs/banners.h similarity index 100% rename from include/system/dev/banners.h rename to include/system/vfs/banners.h diff --git a/include/system/vfs/file_descriptor.hpp b/include/system/vfs/file_descriptor.hpp new file mode 100644 index 00000000..94d1cd79 --- /dev/null +++ b/include/system/vfs/file_descriptor.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +namespace zest::fs { +class FileDescriptor { + public: + constexpr FileDescriptor(int fd) + : m_fd(fd) {} + + explicit operator int() const { + return m_fd; + } + + std::strong_ordering operator<=>(const FileDescriptor&) const = default; + + private: + int m_fd; +}; + +inline constexpr FileDescriptor FD_STDIN{0}; +inline constexpr FileDescriptor FD_STDOUT{1}; +inline constexpr FileDescriptor FD_STDERR{2}; +} // namespace zest::fs \ No newline at end of file diff --git a/include/system/vfs/file_driver.hpp b/include/system/vfs/file_driver.hpp new file mode 100644 index 00000000..40402cdb --- /dev/null +++ b/include/system/vfs/file_driver.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include "system/vfs/file_descriptor.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace zest::fs { +class FileDriver : public std::enable_shared_from_this { + public: + virtual void init() = 0; + virtual std::expected + open(const char* path, int flags, int mode) = 0; + virtual std::expected read(std::any, std::span) = 0; + virtual std::expected write(std::any, std::span) = 0; + virtual std::expected close(std::any) = 0; + virtual std::expected fstat(std::any, struct stat*) = 0; + virtual bool isatty(std::any) = 0; + virtual std::expected lseek(std::any, off_t, int) = 0; + virtual int ctl(std::any, const uint32_t, void* const) = 0; + FileDescriptor add_vfs_entry(std::any data); + int32_t update_vfs_entry(FileDescriptor fd, std::any data); + virtual ~FileDriver() = default; +}; +} // namespace zest::fs \ No newline at end of file diff --git a/include/system/vfs/file_flags.hpp b/include/system/vfs/file_flags.hpp new file mode 100644 index 00000000..c492c251 --- /dev/null +++ b/include/system/vfs/file_flags.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include + +namespace zest::fs { + struct FileFlags { + FileFlags(int flags) + : read(flags & O_RDONLY), + write(flags & O_WRONLY || flags & O_CREAT), + append(flags & O_APPEND), + truncate(flags & O_TRUNC), + create_new(flags & O_CREAT && flags & O_EXCL) {} + + bool read : 1; + bool write : 1; + bool append : 1; + bool truncate : 1; + bool create_new : 1; + }; + } // namespace zest::fs \ No newline at end of file diff --git a/include/system/dev/ser.h b/include/system/vfs/ser.h similarity index 100% rename from include/system/dev/ser.h rename to include/system/vfs/ser.h diff --git a/include/system/dev/usd.h b/include/system/vfs/usd.h similarity index 100% rename from include/system/dev/usd.h rename to include/system/vfs/usd.h diff --git a/include/system/vfs/usd_driver.hpp b/include/system/vfs/usd_driver.hpp new file mode 100644 index 00000000..32e27873 --- /dev/null +++ b/include/system/vfs/usd_driver.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include "pros/rtos.hpp" +#include "system/vfs/file_driver.hpp" +#include "v5_apitypes_patched.h" + +#include + +namespace zest::fs { +class UsdDriver : public FileDriver { + public: + void init() override {} + + std::expected + open(const char* path, int flags, int mode) override; + std::expected read(std::any, std::span) override; + std::expected write(std::any, std::span) override; + std::expected close(std::any) override; + std::expected fstat(std::any, struct stat*) override; + bool isatty(std::any) override; + std::expected lseek(std::any, off_t, int) override; + int ctl(std::any, const uint32_t, void* const) override; + ~UsdDriver() override = default; + + private: + struct File { + FIL* fd; + bool is_writable; + }; + + template + auto inline with_lock(F&& fun, Args... args) { + std::lock_guard lock{this->mut}; + return fun(args...); + } + + pros::RecursiveMutex mut{}; +}; + +} // namespace zest::fs \ No newline at end of file diff --git a/include/system/dev/vfs.h b/include/system/vfs/vfs.h similarity index 100% rename from include/system/dev/vfs.h rename to include/system/vfs/vfs.h diff --git a/src/system/dev/file_system_stubs.c b/src/system/vfs/file_system_stubs.c similarity index 86% rename from src/system/dev/file_system_stubs.c rename to src/system/vfs/file_system_stubs.c index c4e01c84..452ac7d0 100644 --- a/src/system/dev/file_system_stubs.c +++ b/src/system/vfs/file_system_stubs.c @@ -17,10 +17,7 @@ #include #include -int chdir(const char* path) { - errno = ENOSYS; - return -1; -} + int mkdir(const char* pathname, mode_t mode) { errno = ENOSYS; @@ -47,11 +44,6 @@ long pathconf(const char* path, int name) { return -1; } -char* getcwd(char* buf, size_t size) { - errno = ENOSYS; - return NULL; -} - int _unlink(const char* name) { errno = ENOSYS; return -1; diff --git a/src/system/dev/ser_daemon.c b/src/system/vfs/ser_daemon.c similarity index 99% rename from src/system/dev/ser_daemon.c rename to src/system/vfs/ser_daemon.c index 2fb86ec7..ce7f0043 100644 --- a/src/system/dev/ser_daemon.c +++ b/src/system/vfs/ser_daemon.c @@ -16,7 +16,7 @@ */ #include "kapi.h" -#include "system/dev/banners.h" +#include "system/vfs/banners.h" #include "v5_api_patched.h" #define MAX_COMMAND_LENGTH 32 diff --git a/src/system/dev/ser_driver.c b/src/system/vfs/ser_driver.c similarity index 99% rename from src/system/dev/ser_driver.c rename to src/system/vfs/ser_driver.c index eac72ce2..254e930e 100644 --- a/src/system/dev/ser_driver.c +++ b/src/system/vfs/ser_driver.c @@ -17,8 +17,8 @@ #include "common/cobs.h" #include "common/set.h" #include "kapi.h" -#include "system/dev/ser.h" -#include "system/dev/vfs.h" +#include "system/vfs/ser.h" +#include "system/vfs/vfs.h" #include "v5_api_patched.h" #include diff --git a/src/system/dev/usd_driver.c b/src/system/vfs/usd_driver.c similarity index 98% rename from src/system/dev/usd_driver.c rename to src/system/vfs/usd_driver.c index db71291a..c66e5936 100644 --- a/src/system/dev/usd_driver.c +++ b/src/system/vfs/usd_driver.c @@ -13,8 +13,8 @@ // the pragma below is needed due to a FreeRTOS oversight #include "kapi.h" // IWYU pragma: keep -#include "system/dev/usd.h" -#include "system/dev/vfs.h" +#include "system/vfs/usd.h" +#include "system/vfs/vfs.h" #include "v5_api_patched.h" #include diff --git a/src/system/vfs/usd_driver.cpp b/src/system/vfs/usd_driver.cpp new file mode 100644 index 00000000..327ef4a0 --- /dev/null +++ b/src/system/vfs/usd_driver.cpp @@ -0,0 +1,180 @@ +#include "system/vfs/usd_driver.hpp" + +#include "system/vfs/file_flags.hpp" +#include "v5_api_patched.h" +#include "v5_apitypes_patched.h" + +#include +#include + +static std::error_condition map_fresult(FRESULT result) { + // See http://elm-chan.org/fsw/ff/doc/rc.html for a description of FRESULT codes + switch (result) { + case FR_OK: + return {}; + case FR_DISK_ERR: + return std::errc::state_not_recoverable; + case FR_INT_ERR: + return std::errc::state_not_recoverable; + case FR_NOT_READY: + return std::errc::device_or_resource_busy; + case FR_NO_FILE: + return std::errc::no_such_file_or_directory; + case FR_NO_PATH: + return std::errc::no_such_file_or_directory; + case FR_INVALID_NAME: + return std::errc::invalid_argument; + case FR_DENIED: + return std::errc::permission_denied; + case FR_EXIST: + return std::errc::file_exists; + case FR_INVALID_OBJECT: + return std::errc::io_error; + case FR_WRITE_PROTECTED: + return std::errc::read_only_file_system; + case FR_INVALID_DRIVE: + return std::errc::no_such_device_or_address; + case FR_NOT_ENABLED: + return std::errc::io_error; + case FR_NO_FILESYSTEM: + return std::errc::no_such_device_or_address; + case FR_MKFS_ABORTED: + return std::errc::io_error; + case FR_TIMEOUT: + return std::errc::io_error; + case FR_LOCKED: + return std::errc::permission_denied; + case FR_NOT_ENOUGH_CORE: + return std::errc::not_enough_memory; + case FR_TOO_MANY_OPEN_FILES: + return std::errc::too_many_files_open_in_system; + case FR_INVALID_PARAMETER: + return std::errc::invalid_argument; + default: + __builtin_abort(); // TODO: log error + } +} + +std::expected +zest::fs::UsdDriver::open(const char* path, int _flags, int mode [[maybe_unused]]) { + FRESULT result = this->with_lock(vexFileMountSD); + if (result != FR_OK) { + return std::unexpected{map_fresult(result)}; + } + + const zest::fs::FileFlags flags{_flags}; + File file = {nullptr, flags.write}; + + if (flags.create_new && this->with_lock(vexFileStatus, path) != 0) { + // User specified create_new but the file already exists + return std::unexpected{std::errc::file_exists}; + } + + if (flags.read && !flags.write) { + // Open in read-only mode + file.fd = this->with_lock(vexFileOpen, path, ""); // mode is ignored + } else if (flags.write && flags.append) { + // Open in write & append mode + file.fd = this->with_lock(vexFileOpenWrite, path); + } else if (flags.write && flags.truncate) { + // Open in write mode & truncate file + file.fd = this->with_lock(vexFileOpenCreate, path); + } else if (flags.write) { + // Open in write & overwrite mode + file.fd = this->with_lock(vexFileOpenWrite, path); + this->with_lock(vexFileSeek, file.fd, 0, 0); + } else { + return std::unexpected{std::errc::invalid_argument}; + } + if (file.fd == nullptr) { + return std::unexpected{std::errc::too_many_files_open_in_system}; + } + return this->add_vfs_entry(std::any{file}); +} + +std::expected +zest::fs::UsdDriver::read(std::any _file, std::span output) { + auto [file, is_writable] = std::any_cast(_file); + if (is_writable) { + return std::unexpected{std::errc::operation_not_permitted}; + } + char* out_ptr = reinterpret_cast(output.data()); + return this->with_lock(vexFileRead, out_ptr, 1, output.size(), file); +} + +std::expected +zest::fs::UsdDriver::write(std::any _file, std::span input) { + auto [file, is_writable] = std::any_cast(_file); + if (!is_writable) { + return std::unexpected{std::errc::operation_not_permitted}; + } + char* in_ptr = reinterpret_cast(input.data()); + return this->with_lock(vexFileWrite, in_ptr, 1, input.size(), file); +} + +std::expected zest::fs::UsdDriver::close(std::any _file) { + FIL* file = std::any_cast(_file).fd; + this->with_lock(vexFileClose, file); + return {}; +} + +std::expected +zest::fs::UsdDriver::fstat(std::any _file, struct stat* stats) { + FIL* file = std::any_cast(_file).fd; + stats->st_size = this->with_lock(vexFileSize, file); + // TODO: set st_mode based to indicate file vs directory + return {}; +} + +bool zest::fs::UsdDriver::isatty(std::any _file [[maybe_unused]]) { + return false; +} + +std::expected +zest::fs::UsdDriver::lseek(std::any _file, off_t offset, int dir) { + FIL* file = std::any_cast(_file).fd; + FRESULT result; + switch (dir) { + case 0: { + result = this->with_lock(vexFileSeek, file, offset, 0); + break; + } + case 1: { + if (offset >= 0) { + result = this->with_lock(vexFileSeek, file, offset, 1); + } else { + // VEXos does not support negative seek offsets, so we calculate the offset from the + // start of the file ourselves. + auto stream_pos = this->with_lock(vexFileTell, file); + result = this->with_lock(vexFileSeek, file, stream_pos + offset, 0); + } + break; + } + case 2: { + if (offset >= 0) { + result = this->with_lock(vexFileSeek, file, offset, 2); + } else { + // VEXos does not support negative seek offsets, so we calculate the offset from the + // start of the file ourselves. + struct stat stats; + if (auto result = this->fstat(_file, &stats); !result.has_value()) { + return std::unexpected{result.error()}; + } + auto file_size = stats.st_size; + result = this->with_lock(vexFileSeek, file, offset + file_size, 0); + } + break; + } + default: { + return std::unexpected{std::errc::invalid_argument}; + } + } + if (auto err = map_fresult(result); err) { + return std::unexpected{err}; + } + return this->with_lock(vexFileTell, file); +} + +int zest::fs::UsdDriver::ctl(std::any _file [[maybe_unused]], uint32_t, void* const) { + return 0; +} \ No newline at end of file diff --git a/src/system/dev/vfs.c b/src/system/vfs/vfs.c similarity index 95% rename from src/system/dev/vfs.c rename to src/system/vfs/vfs.c index c8b02f1e..d04add06 100644 --- a/src/system/dev/vfs.c +++ b/src/system/vfs/vfs.c @@ -21,18 +21,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "system/dev/vfs.h" - -#include "common/gid.h" -#include "kapi.h" -#include "system/dev/dev.h" -#include "system/dev/ser.h" -#include "system/dev/usd.h" - #include #include #include +#include "common/gid.h" +#include "kapi.h" +#include "system/vfs/ser.h" +#include "system/vfs/usd.h" +#include "system/vfs/vfs.h" + #define MAX_FILELEN 128 #define MAX_FILES_OPEN 31 @@ -91,6 +89,7 @@ int vfs_update_entry(int file, struct fs_driver const* const driver, void* arg) return 0; } +/* int _open(const char* file, int flags, int mode) { struct _reent* r = _REENT; // Check if the filename is too long or not NULL terminated @@ -109,13 +108,12 @@ int _open(const char* file, int flags, int mode) { return ser_open_r(r, file + strlen("/ser"), flags, mode); } else if (strstr(file, "/usd") == file) { return usd_open_r(r, file + strlen("/usd"), flags, mode); - //} else if (strstr(file, "/dev") == file) { - // return dev_open_r(r, file + strlen("/dev"), flags, mode); } else { return usd_open_r(r, file, flags, mode); } } - +*/ +/* ssize_t _write(int file, const void* buf, size_t len) { struct _reent* r = _REENT; if (file < 0 || !gid_check(&file_table_gids, file)) { @@ -124,8 +122,8 @@ ssize_t _write(int file, const void* buf, size_t len) { return -1; } return file_table[file].driver->write_r(r, file_table[file].arg, buf, len); -} - +}*/ +/* ssize_t _read(int file, void* buf, size_t len) { struct _reent* r = _REENT; if (file < 0 || !gid_check(&file_table_gids, file)) { @@ -134,8 +132,8 @@ ssize_t _read(int file, void* buf, size_t len) { return -1; } return file_table[file].driver->read_r(r, file_table[file].arg, buf, len); -} - +}*/ +/* int _close(int file) { struct _reent* r = _REENT; // NOTE: newlib automatically closes all open files for a given task when @@ -192,4 +190,4 @@ int32_t fdctl(int file, const uint32_t action, void* const extra_arg) { return -1; } return file_table[file].driver->ctl(file_table[file].arg, action, extra_arg); -} +}*/ diff --git a/src/system/vfs/vfs.cpp b/src/system/vfs/vfs.cpp new file mode 100644 index 00000000..41b5731f --- /dev/null +++ b/src/system/vfs/vfs.cpp @@ -0,0 +1,195 @@ +#include "pros/rtos.hpp" +#include "system/vfs/file_descriptor.hpp" +#include "system/vfs/file_driver.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace zest::fs { +namespace { +struct FileEntry { + std::shared_ptr driver; + std::any data; +}; +} // namespace +} // namespace zest::fs + +constexpr static size_t MAX_FILE_DESCRIPTORS = 64; + +static constinit pros::RecursiveMutex vfs_mut{}; +static constinit std::array, MAX_FILE_DESCRIPTORS> fd_data{}; +static constinit std::string working_directory = "/usd"; +// FIXME: fix static initialization order fiasco +static std::unordered_map> drivers{}; + +zest::fs::FileDescriptor zest::fs::FileDriver::add_vfs_entry(std::any data) { + std::lock_guard lock{vfs_mut}; + for (auto it = fd_data.begin(); it != fd_data.end(); ++it) { + if (!it->has_value()) { + *it = {.driver = this->shared_from_this(), .data = data}; + return it - fd_data.begin(); + } + } + return -1; +} + +int32_t zest::fs::FileDriver::update_vfs_entry(zest::fs::FileDescriptor fd, std::any data) { + std::lock_guard lock{vfs_mut}; + if (fd < 0 || fd >= fd_data.size()) + return -1; + if (fd_data[static_cast(fd)].has_value()) + return -1; + fd_data[static_cast(fd)] = {.driver = this->shared_from_this(), .data = data}; + return 0; +} + +static auto with_fd(int file, std::invocable auto func) { + using ReturnType = decltype(func(zest::fs::FileEntry{}))::value_type; + struct _reent* r = _REENT; + zest::fs::FileEntry file_entry; + try { + file_entry = fd_data.at(file).value(); + } catch (std::bad_optional_access&) { + r->_errno = EBADF; + return ReturnType{-1}; + } catch (std::out_of_range&) { + r->_errno = EBADF; + return ReturnType{-1}; + } + auto result = func(file_entry); + if (result) { + return result.value(); + } else { + r->_errno = result.error().value(); + return ReturnType{-1}; + } +} + +// newlib fs stubs: these must be extern "C" to prevent name mangling, +// which would prevent newlib from linking to these functions properly + +extern "C" { + +int _open(const char* file, int flags, int mode) { + std::lock_guard lock{vfs_mut}; + struct _reent* r = _REENT; + + std::string path = file; + if (!path.starts_with("/")) + path = working_directory + path; + + auto idx = path.find("/", 1); + if (idx == std::string::npos) { + idx = path.size() - 1; + } + + std::string_view trimmed_path = path; + trimmed_path.remove_prefix(idx + 1); + std::string driver_name = path.substr(1, idx); + + auto driver = [&] { + auto it = drivers.find(driver_name); + if (it != drivers.end()) + return it->second; + return std::shared_ptr{nullptr}; + }(); + + if (driver == nullptr) { + r->_errno = ENOENT; + return -1; + } + + return static_cast(driver->open(trimmed_path.cbegin(), flags, mode).value_or(-1)); +} + +int chdir(const char* path) { + std::lock_guard lock{vfs_mut}; + std::string_view new_path = path; + if (!new_path.ends_with('/')) { + // TODO: should we append a slash? + errno = ENOTDIR; + return -1; + } + if (new_path.starts_with('/')) { + working_directory = new_path; + } else { + working_directory += new_path; + } + return 0; +} + +char* getcwd(char* buf, size_t size) { + std::lock_guard lock{vfs_mut}; + if (size == 0) { + // TODO: implement glibc extension? + errno = EINVAL; + return nullptr; + } + if (working_directory.size() + 1 > size) { + errno = ERANGE; + return nullptr; + } + std::copy(working_directory.cbegin(), working_directory.cend(), buf); + return buf; +} + +ssize_t _write(int file, void* buf, size_t len) { + return with_fd(file, [&](zest::fs::FileEntry file_entry) { + return file_entry.driver->write( + file_entry.data, + std::span{static_cast(buf), len} + ); + }); +} + +ssize_t _read(int file, void* buf, size_t len) { + return with_fd(file, [&](zest::fs::FileEntry file_entry) { + return file_entry.driver->read( + file_entry.data, + std::span{static_cast(buf), len} + ); + }); +} + +int _close(int file) { + // TODO: implement + (void)file; + return 0; +} + +int _fstat(int file, struct stat* st) { + return with_fd(file, [&](zest::fs::FileEntry file_entry) { + return file_entry.driver->fstat(file_entry.data, st).transform([]() { + return 0; + }); + }); +} + +off_t _lseek(int file, off_t ptr, int dir) { + return with_fd(file, [&](zest::fs::FileEntry file_entry) { + return file_entry.driver->lseek(file_entry.data, ptr, dir); + }); +} + +int _isatty(int file) { + return with_fd(file, [&](zest::fs::FileEntry file_entry) { + bool is_atty = file_entry.driver->isatty(file_entry.data); + return std::expected{is_atty}; + }); +} + +int32_t fdctl(int file, uint32_t action, void* extra_arg) { + return with_fd(file, [&](zest::fs::FileEntry file_entry) { + int ret_val = file_entry.driver->ctl(file_entry.data, action, extra_arg); + return std::expected{ret_val}; + }); +} +} \ No newline at end of file