2 ms·
Just curious, I'm not good with C. Here in the code, https://github.com/google/pebble/blob/main/src/libc/alloca.c#L19 https://github.com/google/pebble/blob/main
by markus_zhang 2y ago
Just curious, I'm not good with C. Here in the code, https://github.com/google/pebble/blob/main/src/libc/alloca.c#L19 https://github.com/google/pebble/blob/main/src/libc/alloca.c...
From what I googled, this is just for stack allocation in gcc. Does that mean Pebble only has stack allocation?
- Cieric 2y agoAlloca is allocations on the stack, seems the kernel might be stack based, but the os itself has it's own implementation of malloc. Which is heap based. https://github.com/google/pebble/blob/main/src/libos/include/os/malloc.h https://github.com/google/pebble/blob/main/src/libos/include... I'm also seeing references to rtos as the true underlying os though.
- markus_zhang 2y agoThanks found it, https://github.com/google/pebble/blob/main/src/fw/kernel/pbl_malloc.c#L228 https://github.com/google/pebble/blob/main/src/fw/kernel/pbl... Which calls heap malloc: https://github.com/google/pebble/blob/main/src/libutil/heap.c#L236 https://github.com/google/pebble/blob/main/src/libutil/heap....
- tesseract 2y agoIt was based on FreeRTOS, but FreeRTOS at the time was extremely bare bones and only provided a preemptive scheduler, task management, and synchronization primitives. Everything else (memory management, I/O, ...) had to come either from whatever libc implementation was in use, or be built from scratch.
- markus_zhang 2y agoThanks, does that mean early FreeRTOS is a good beginner project for OS study?
- tesseract 2y agoIn my opinion it's not always the most readable codebase, due to some idiosyncratic style choices, but it definitely has the advantages of being small and focused.
- markus_zhang 2y agoThank you!
- deleted 2y ago[deleted]