fix: Resolve build errors and add multi-core synchronization#9
Open
muditbhargava66 wants to merge 3 commits intoasynts:trunkfrom
Open
fix: Resolve build errors and add multi-core synchronization#9muditbhargava66 wants to merge 3 commits intoasynts:trunkfrom
muditbhargava66 wants to merge 3 commits intoasynts:trunkfrom
Conversation
Fixes asynts#8 ## Build Fixes - Added Tools/compat/elf.h for macOS ELF definitions - Replaced Linux-specific memfd_create/copy_file_range with ANSI C - Removed unsupported -fropi/-frwpi flags and -lbsd dependency - Fixed missing MaskedInterruptGuard.hpp includes - Ensured 8-byte stack alignment to prevent hardfaults ## New Features - SoftwareSpinLock with deadlock detection and wfe/sev - SoftwareMutex for blocking synchronization - WaitingThreadQueue for thread management - Power-efficient multi-core sync primitives ## Bug Fixes - Fixed HardwareSpinLock infinite loop on lock acquisition - Fixed memory leaks in VirtualFileHandle - Fixed stat /dev/tty returning invalid device info - Fixed ConsoleFileHandle invalid pointer issues ## Documentation - Restructured Docs/ with architecture guides - Added Mermaid diagrams for visualization - Created syscall reference and shell command docs ## Configuration - Added VSCode IntelliSense and Cortex-Debug support - Updated CMakeLists.txt with version info - Reformatted CHANGELOG.md following Keep a Changelog
- **Multi-Core**: Implemented SMP scheduler for RP2040 using `HardwareSpinLock`. - **Std Lib Enhancements**: - Upgraded `SortedSet` to Red-Black Tree (O(log n)). - Refactored `Vector` and `Array` for safety (`at()`) and standard iteration. - Improved `Singleton` thread-safety documentation and CRTP support. - **Userland**: Implemented free-list `malloc/free` with coalescing. - **Fixes**: Resolved `stat /dev/tty` device ID bug. - **Docs**: Updated CHANGELOG and TODO.
This commit introduces major architectural improvements to the PicoOS kernel: - **Memory Management**: - Implemented dynamic kernel heap growth in `GlobalMemoryAllocator`. - Refactored `PageAllocator` with Buddy System handling and detailed documentation. - Added `add_memory` support to `Std::MemoryAllocator`. - Added `ScopedLock` (RAII) for thread-safe allocation detailed in `Kernel/Synchronization/ScopedLock.hpp`. - **Security**: - Implemented Stack Smashing Protection (SSP) with hardware-randomized canaries using RP2040 ROSC (`StackProtector.cpp`). - Enhanced HardFault handlers to differentiate User/Kernel faults and dump register state. - **System**: - Updated `linker.ld` to enforce 8-byte alignment for .stack and .heap sections. - Removed unstable emulation scripts. - **Documentation**: - Added `Docs/architecture/memory.md` detailing memory model and security. - Updated `README.md`, `Docs/index.md`, and `Docs/architecture/system_overview.md`. - Updated `TODO.md` and `CHANGELOG.md`. Fixes build system alignment issues and completes several TODO items.
Author
Update 2 – 2025-12-14This update continues the build-fix work and focuses on internal cleanup of the kernel memory path, fault diagnostics, and basic safety checks. The intent here is correctness and debuggability on RP2040, not feature completeness. Kernel Core & Memory
Safety / Defensive Checks
Documentation
Build & Status
Status: Marked as Draft while hardware testing and allocator stress testing are finalized. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR resolves build errors reported in #8 and adds significant improvements
to the PicoOS codebase.
Fixes #8
Changes
Build System Fixes
Tools/compat/elf.hfor macOS ELF definitionsmemfd_create/copy_file_rangewith ANSI C-fropi/-frwpiflagsNew Synchronization Primitives
SoftwareSpinLockwith deadlock detectionSoftwareMutexfor blocking synchronizationWaitingThreadQueuefor thread managementwfe/sevimplementationBug Fixes
/dev/ttystat informationDocumentation
Docs/with comprehensive guidesTesting
Screenshots
N/A (no UI changes)