Comments (1)
@xobs moving conversation from #7 to this issue. Quoting the whole response here for continuity.
I was having a chat with @mithro, and the idea came up to use a thunked syscall interface.
The idea being that you'd have a function at a well-known address, or an address defined in a LiteX CSR, or an address defined in a RISC-V MSR, that has a function signature such as:
int syscall(uint32_t family, uint32_t syscall, uint32_t arg1, void *arg2);...or similar. Maybe the params would be different. But we'd define
family
andsyscall
as enum pairs. For example, "reboot" might be in the "system" family. Using 32-bit IFF-style tags, such a call might be:syscall('syst', 'boot', 0x20040000, NULL);Because the boot ROM is currently always memory-mapped, we could fix it at address 0x100, so any machine-level program could cast that value to a function pointer and make syscalls.
Then, as part of the BIOS for various platforms, you'd implement
syscall
:__attribute__((section(".text.syscall"))) int syscall(uint32_t family, uint32_t call, uint32_t arg1, void *arg2) { switch (family) { case 'syst': return do_syst(call, arg1, arg2); default: return -EIMPL; } } static int do_syst(uint32_t call, uint32_t arg1, void *arg2) { switch (family) { case 'boot': return do_reboot(arg1); default: return -EIMPL; } }
Agreed, we could also define inlines/macros to make the code more readable.
syscall('syst', 'boot', 0x20040000, NULL);
could become
syscall_syst_boot(0x20040000);
Once we have the i/o for the bootloader defined in this manner we can take a look at defining some platform i/o for micropython. Stuff like rgb would be platform specific but we can define a very basic interface that exposes n buttons, n leds and a set of n io pins. On fomu the buttons could be touch under the hood. We'd also want to look ahead to circuitpython and make sure we can define an optional platform i2c in some manner too.
from foboot.
Related Issues (20)
- Add DFU signature support? HOT 2
- Auto-boot image after 5 seconds HOT 1
- Booting from RAM HOT 2
- Stability after switching to eptri HOT 2
- Add support for tinyfpga-bx board
- Add support for ECP5 hardware HOT 30
- Fails to meet timing without specifying a seed HOT 5
- Needs better instructions for loading the bootloader
- Can't build - ERROR: Conflicting init values for signal 1'0 (\cpu_interrupt [0] = 1'0 != 1'x). HOT 1
- Building --no-cpu creates memory overlap
- Issue building new updater -- Unable to open booster.bin HOT 3
- RAM load doesn't work for me HOT 7
- tinyusb examples don't seem to work with current head of master (e928b868) HOT 2
- Instability seen with some Fomu with v2.0.3
- Can't seem to update my Fomu HOT 7
- fomu can be be bricked by flashing too large of an image HOT 8
- Maximum writable file size through dfu HOT 2
- Potential typo bug in foboot/main.c HOT 5
- Litex SPI Flash Core Was Deprecated in Favor of LiteSPI
- string.h: No such file or directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foboot.