Skip to content

Commit

Permalink
initial draft for multithreaded rp2040
Browse files Browse the repository at this point in the history
  • Loading branch information
sberkun committed Feb 1, 2024
1 parent 36b3d4a commit f70fd5d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ CodeBuilder generateCMakeCode(
}

if (!targetConfig.get(SingleThreadedProperty.INSTANCE)
&& platformOptions.platform() != Platform.ZEPHYR) {
&& platformOptions.platform() != Platform.ZEPHYR
&& platformOptions.platform() != Platform.RP2040) {
// If threaded computation is requested, add the threads option.
cMakeCode.pr("# Find threads and link to it");
cMakeCode.pr("find_package(Threads REQUIRED)");
Expand Down Expand Up @@ -504,9 +505,9 @@ private static String setUpMainTargetRp2040(
code.pr("pico_sdk_init()");
code.newLine();
code.pr("add_subdirectory(core)");
code.pr("target_link_libraries(core PUBLIC pico_stdlib)");
code.pr("target_link_libraries(core PUBLIC pico_multicore)");
code.pr("target_link_libraries(core PUBLIC pico_sync)");
code.pr("target_link_libraries(reactor-c PUBLIC pico_stdlib)");
code.pr("target_link_libraries(reactor-c PUBLIC pico_multicore)");
code.pr("target_link_libraries(reactor-c PUBLIC pico_sync)");
code.newLine();
code.pr("set(LF_MAIN_TARGET " + executableName + ")");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ protected PlatformOptions fromString(String string, MessageReporter reporter) {
@Override
public void validate(TargetConfig config, MessageReporter reporter) {
var singleThreaded = config.get(SingleThreadedProperty.INSTANCE);
if (!singleThreaded && config.get(PlatformProperty.INSTANCE).platform == Platform.RP2040) {
if (!singleThreaded && !config.get(PlatformProperty.INSTANCE).platform.isMultiThreaded()) {
reporter
.at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE)
.error("Platform " + Platform.RP2040 + " does not support threading.");
.error("Platform " + config.get(PlatformProperty.INSTANCE).platform + " does not support threading.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum Platform {
AUTO,
ARDUINO, // FIXME: not multithreaded
NRF52("Nrf52", true),
RP2040("Rp2040", false),
RP2040("Rp2040", true),
LINUX("Linux", true),
MAC("Darwin", true),
ZEPHYR("Zephyr", true),
Expand Down

0 comments on commit f70fd5d

Please sign in to comment.