ole / swift-rp-pico-bare

Embedded Swift on the Raspberry Pi Pico without the Pico C/C++ SDK
93 stars 3 forks source link

Fix broken peripherals init after boot #6

Closed ole closed 8 months ago

ole commented 8 months ago

Reverts commit 7978162: Move runtime_init into SDK library.

Fixes #5.

The linker script in the Raspberry Pi Pico C SDK defines a symbol called runtime_init and calls that function automatically just before calling main(). This is convenient, but it also makes it less obvious what's required to initialize the RP2040 after boot. I decided to make this call an explicit step for transparency into the boot process. Clients must call runtimeInit() from their main() function before they access any peripheral.