Skip to content

Commit

Permalink
Merge pull request #2178 from lf-lang/rp2040-multicore
Browse files Browse the repository at this point in the history
Rp2040 multithreaded target support
  • Loading branch information
lhstrh authored May 29, 2024
2 parents 9e909a8 + 2de8269 commit a20b36a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ CodeBuilder generateCMakeCode(

if (!targetConfig.get(SingleThreadedProperty.INSTANCE)
&& platformOptions.platform() != Platform.ZEPHYR
&& platformOptions.platform() != Platform.FLEXPRET) {
&& platformOptions.platform() != Platform.FLEXPRET
&& 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 @@ -558,9 +559,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 @@ -115,9 +115,6 @@ protected PlatformOptions fromString(String string, MessageReporter reporter) {
public void validate(TargetConfig config, MessageReporter reporter) {
var platform = config.get(PlatformProperty.INSTANCE).platform;
switch (platform) {
case RP2040:
validateRP2040(config, reporter);
break;
case FLEXPRET:
validateFlexPRET(config, reporter);
break;
Expand All @@ -129,15 +126,6 @@ public void validate(TargetConfig config, MessageReporter reporter) {
}
}

private void validateRP2040(TargetConfig config, MessageReporter reporter) {
var singleThreaded = config.get(SingleThreadedProperty.INSTANCE);
if (!singleThreaded) {
reporter
.at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE)
.error("Platform " + Platform.RP2040 + " does not support threading.");
}
}

private void validateFlexPRET(TargetConfig config, MessageReporter reporter) {
var platform = config.get(PlatformProperty.INSTANCE);
var board = platform.board();
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 a20b36a

Please sign in to comment.