Skip to content

Expand docs: Baremetal setup, update pico integration #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2025
Merged

Conversation

kubamracek
Copy link
Collaborator

No description provided.

@kubamracek kubamracek requested a review from rauhul as a code owner May 23, 2025 21:27
Base automatically changed from doc-update to main May 23, 2025 21:28
Example vector table structure:

```c
// Vector table for ARM Cortex-M
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a todo or gh issue to migrate these to InlineArray?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's realistic to migrate to InlineArray today -- I think the blocker is @section being able to handle a not-completely-straightforward array, because the vector table also needs the initial SP (which is not a fptr). I can certainly file a GH issue to track this.

};
```

If you want to actually handle an interrupt (e.g. a GPIO or UART interrupt) in your Swift code, you can forward declare the function in C, and define it using `@cdecl` in Swift:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using InlineArray here would ease this learning curve by not requiring forward declarations.


However, note that Swift currently does not provide any form of synchronization or "interrupt safety" for the code that executes the interrupt. Namely, if your interrupt handler modifies global variables that are also accessed by your main program, you need to be careful about data races and ensure proper synchronization (such as using atomic operations or disabling interrupts during critical sections). Additionally, interrupt handlers should be kept short and fast to avoid blocking other important system events.

## Building a minimal project
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty great, but likely should move the to build-system support section

@@ -94,7 +93,7 @@ $ export PICO_SDK_PATH=<path_to_pico_sdk>
$ export PICO_TOOLCHAIN_PATH=<path_to_arm_toolchain>
$ ls -al
-rw-r--r-- 1 kuba staff 39B Feb 2 22:08 BridgingHeader.h
-rw-r--r-- 1 kuba staff 1.3K Feb 2 22:08 CMakeLists.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@rauhul rauhul merged commit 1ce88ec into main May 29, 2025
21 checks passed
@rauhul rauhul deleted the doc-update2 branch May 29, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants