From 1db738c1b5213872e2b48d48e6f785a1c26c2c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 21 Apr 2024 17:20:48 +0200 Subject: [PATCH 01/42] Add support for FlexPRET --- .../lflang/generator/c/CCmakeGenerator.java | 77 ++++++++++++++++++- .../target/property/type/PlatformType.java | 1 + 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index 69ecc4b43c..d2b7f74422 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -135,6 +135,10 @@ CodeBuilder generateCMakeCode( } } + for (String prop : boardProperties) { + System.out.println(prop); + } + additionalSources.addAll(this.additionalSources); cMakeCode.newLine(); @@ -196,6 +200,23 @@ CodeBuilder generateCMakeCode( } // remove warnings for rp2040 only to make debug easier cMakeCode.pr("set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -w\")"); + break; + case FLEXPRET: + if (System.getenv("FP_SDK_PATH") == null) { + // TODO: Consider checking registering FP SDK in cmake package registry + messageReporter. + nowhere(). + warning("No FP_SDK_PATH environment variable found"); + } + cMakeCode.newLine(); + cMakeCode.pr("# Include toolchain file and set project"); + cMakeCode.pr("include($ENV{FP_SDK_PATH}/cmake/riscv-toolchain.cmake)"); + cMakeCode.pr("Project(" + executableName + " LANGUAGES C ASM)"); + cMakeCode.newLine(); + + // TODO: Probably need to set FlexPRET emulator vs. FPGA; Could be encded + // in board? + break; default: cMakeCode.pr("project(" + executableName + " LANGUAGES C)"); @@ -289,6 +310,13 @@ CodeBuilder generateCMakeCode( executableName, Stream.concat(additionalSources.stream(), sources.stream()))); break; + case FLEXPRET: + cMakeCode.pr( + setUpMainTargetFlexPRET( + hasMain, + executableName, + Stream.concat(additionalSources.stream(), sources.stream()))); + break; default: cMakeCode.pr( setUpMainTarget.getCmakeCode( @@ -326,6 +354,19 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("pico_enable_stdio_usb(${LF_MAIN_TARGET} " + (usb ? 1 : 0) + ")"); cMakeCode.pr("pico_enable_stdio_uart(${LF_MAIN_TARGET} " + (uart ? 1 : 0) + ")"); break; + case FLEXPRET: + cMakeCode.pr("# Include necessary commands to generate .mem, .dump files"); + cMakeCode.pr("include($ENV{FP_SDK_PATH}/cmake/fp-app.cmake)"); + cMakeCode.pr("set(CMAKE_EXECUTABLE_SUFFIX \".riscv\")"); + cMakeCode.newLine(); + + cMakeCode.pr("# .dump file contains program in assembly instructions"); + cMakeCode.pr("fp_add_dump_output(${LF_MAIN_TARGET})"); + cMakeCode.newLine(); + cMakeCode.pr("# .mem contains the program as a hex file"); + cMakeCode.pr("fp_add_mem_output(${LF_MAIN_TARGET})"); + cMakeCode.newLine(); + break; } if (targetConfig.get(AuthProperty.INSTANCE)) { @@ -364,7 +405,7 @@ CodeBuilder generateCMakeCode( cMakeCode.newLine(); } else { cMakeCode.pr("# Set flag to indicate a single-threaded runtime"); - cMakeCode.pr("target_compile_definitions( ${LF_MAIN_TARGET} PUBLIC LF_SINGLE_THREADED=1)"); + cMakeCode.pr("target_compile_definitions(${LF_MAIN_TARGET} PUBLIC LF_SINGLE_THREADED=1)"); } cMakeCode.newLine(); @@ -513,4 +554,38 @@ private static String setUpMainTargetRp2040( code.newLine(); return code.toString(); } + + private static String setUpMainTargetFlexPRET( + boolean hasMain, String executableName, Stream cSources) { + var code = new CodeBuilder(); + code.pr("add_subdirectory(core)"); + code.newLine(); + + code.pr("# Add FlexPRET's out-of-tree SDK"); + code.pr("add_subdirectory($ENV{FP_SDK_PATH} BINARY_DIR)"); + code.newLine(); + + code.pr("set(LF_MAIN_TARGET " + executableName + ")"); + code.newLine(); + + if (hasMain) { + code.pr("# Declare a new executable target and list all its sources"); + code.pr("add_executable("); + } else { + code.pr("# Declare a new library target and list all its sources"); + code.pr("add_library("); + } + code.indent(); + code.pr("${LF_MAIN_TARGET}"); + + cSources.forEach(code::pr); + code.unindent(); + code.pr(")"); + code.newLine(); + + code.pr("target_link_libraries(${LF_MAIN_TARGET} PUBLIC fp-sdk-if)"); + code.newLine(); + + return code.toString(); + } } diff --git a/core/src/main/java/org/lflang/target/property/type/PlatformType.java b/core/src/main/java/org/lflang/target/property/type/PlatformType.java index 6382291c61..56715c2a9c 100644 --- a/core/src/main/java/org/lflang/target/property/type/PlatformType.java +++ b/core/src/main/java/org/lflang/target/property/type/PlatformType.java @@ -18,6 +18,7 @@ public enum Platform { LINUX("Linux", true), MAC("Darwin", true), ZEPHYR("Zephyr", true), + FLEXPRET("FlexPRET", true), WINDOWS("Windows", true); final String cMakeName; From 8b50948095450a56499798541974fad36d12b208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 21 Apr 2024 17:24:09 +0200 Subject: [PATCH 02/42] Remove printing of board properties --- .../src/main/java/org/lflang/generator/c/CCmakeGenerator.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index d2b7f74422..f651c0ac14 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -135,10 +135,6 @@ CodeBuilder generateCMakeCode( } } - for (String prop : boardProperties) { - System.out.println(prop); - } - additionalSources.addAll(this.additionalSources); cMakeCode.newLine(); From f688bd02934076f733289b48540d8cf050c9fdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Mon, 22 Apr 2024 20:11:52 +0200 Subject: [PATCH 03/42] Add check on requested threads vs. number of HW threads on FlexPRET, add support for board target property. --- .../lflang/generator/c/CCmakeGenerator.java | 34 +++++++++++++++---- .../target/property/PlatformProperty.java | 3 +- core/src/main/resources/lib/c/reactor-c | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index f651c0ac14..43db6abce8 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -198,8 +198,12 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -w\")"); break; case FLEXPRET: + if (System.getenv("FP_PATH") == null) { + messageReporter. + nowhere(). + warning("No FP_PATH environment variable found"); + } if (System.getenv("FP_SDK_PATH") == null) { - // TODO: Consider checking registering FP SDK in cmake package registry messageReporter. nowhere(). warning("No FP_SDK_PATH environment variable found"); @@ -210,9 +214,15 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("Project(" + executableName + " LANGUAGES C ASM)"); cMakeCode.newLine(); - // TODO: Probably need to set FlexPRET emulator vs. FPGA; Could be encded - // in board? - + String selectedBoard = platformOptions.board(); + if (selectedBoard != null) { + cMakeCode.pr("# Board selected from target property"); + cMakeCode.pr("set(TARGET " + selectedBoard + ")"); + } else { + cMakeCode.pr("# Default board is verilator"); + cMakeCode.pr("set(TARGET verilator)"); + } + cMakeCode.newLine(); break; default: cMakeCode.pr("project(" + executableName + " LANGUAGES C)"); @@ -362,6 +372,17 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("# .mem contains the program as a hex file"); cMakeCode.pr("fp_add_mem_output(${LF_MAIN_TARGET})"); cMakeCode.newLine(); + + cMakeCode.pr("# Verify that FlexPRET has the number of requested workers"); + cMakeCode.pr("# That information is available in the SDK's hwconfig"); + cMakeCode.pr("include($ENV{FP_SDK_PATH}/flexpret/hwconfig.cmake)"); + cMakeCode.pr("math(EXPR FLEXPRET_AVAILABLE_WORKERS \"${THREADS} - 1\")"); + cMakeCode.pr("if (${NUMBER_OF_WORKERS} GREATER ${FLEXPRET_AVAILABLE_WORKERS})"); + cMakeCode.indent(); + cMakeCode.pr("message(FATAL_ERROR \"Number of requested workers (${NUMBER_OF_WORKERS}) is higher than FlexPRET's number of available workers (${FLEXPRET_AVAILABLE_WORKERS}). Note that FlexPRET uses hardware threads, not the usual software threads.\")"); + cMakeCode.unindent(); + cMakeCode.pr("endif()"); + cMakeCode.newLine(); break; } @@ -382,7 +403,8 @@ CodeBuilder generateCMakeCode( } if (!targetConfig.get(SingleThreadedProperty.INSTANCE) - && platformOptions.platform() != Platform.ZEPHYR) { + && platformOptions.platform() != Platform.ZEPHYR + && platformOptions.platform() != Platform.FLEXPRET) { // If threaded computation is requested, add the threads option. cMakeCode.pr("# Find threads and link to it"); cMakeCode.pr("find_package(Threads REQUIRED)"); @@ -579,7 +601,7 @@ private static String setUpMainTargetFlexPRET( code.pr(")"); code.newLine(); - code.pr("target_link_libraries(${LF_MAIN_TARGET} PUBLIC fp-sdk-if)"); + code.pr("target_link_libraries(${LF_MAIN_TARGET} PUBLIC fp-sdk)"); code.newLine(); return code.toString(); diff --git a/core/src/main/java/org/lflang/target/property/PlatformProperty.java b/core/src/main/java/org/lflang/target/property/PlatformProperty.java index 4e5ea72503..71b9fbbf1f 100644 --- a/core/src/main/java/org/lflang/target/property/PlatformProperty.java +++ b/core/src/main/java/org/lflang/target/property/PlatformProperty.java @@ -145,8 +145,7 @@ public record PlatformOptions( boolean flash, /** - * The baud rate used as a parameter to certain embedded platforms. 9600 is a standard rate - * amongst systems like Arduino, so it's the default value. + * The number of threads requested by the user. */ int userThreads) { diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index b64a805c1a..eb797206c7 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit b64a805c1a78ca67e41026301e67830ee4791cb2 +Subproject commit eb797206c781d956a2b7fcb8d06a1327e66996b5 From 38c83edcdb9326a6960da9f3efd4c1f51fd359fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Wed, 24 Apr 2024 00:56:30 +0200 Subject: [PATCH 04/42] Add support for port property. --- .../lflang/generator/c/CCmakeGenerator.java | 38 +++++++------------ core/src/main/resources/lib/c/reactor-c | 2 +- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index 43db6abce8..c9879c5bf6 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -218,11 +218,16 @@ CodeBuilder generateCMakeCode( if (selectedBoard != null) { cMakeCode.pr("# Board selected from target property"); cMakeCode.pr("set(TARGET " + selectedBoard + ")"); - } else { - cMakeCode.pr("# Default board is verilator"); - cMakeCode.pr("set(TARGET verilator)"); - } - cMakeCode.newLine(); + cMakeCode.newLine(); + } // No TARGET will automatically become emulator + + var selectedFlashDevice = platformOptions.port(); + if (selectedFlashDevice != null) { + cMakeCode.pr("# Flash device selected from target property"); + cMakeCode.pr("set(FP_FLASH_DEVICE " + selectedFlashDevice + ")"); + cMakeCode.newLine(); + } // No FP_FLASH_DEVICE will automatically become /dev/ttyUSB0 + break; default: cMakeCode.pr("project(" + executableName + " LANGUAGES C)"); @@ -346,6 +351,7 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("target_include_directories(${LF_MAIN_TARGET} PUBLIC include/core/platform)"); cMakeCode.pr("target_include_directories(${LF_MAIN_TARGET} PUBLIC include/core/modal_models)"); cMakeCode.pr("target_include_directories(${LF_MAIN_TARGET} PUBLIC include/core/utils)"); + cMakeCode.newLine(); // post target definition board configurations switch (platformOptions.platform()) { @@ -361,27 +367,9 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("pico_enable_stdio_uart(${LF_MAIN_TARGET} " + (uart ? 1 : 0) + ")"); break; case FLEXPRET: - cMakeCode.pr("# Include necessary commands to generate .mem, .dump files"); + cMakeCode.pr("# Include necessary commands to generate .mem, .dump, and executable files"); cMakeCode.pr("include($ENV{FP_SDK_PATH}/cmake/fp-app.cmake)"); - cMakeCode.pr("set(CMAKE_EXECUTABLE_SUFFIX \".riscv\")"); - cMakeCode.newLine(); - - cMakeCode.pr("# .dump file contains program in assembly instructions"); - cMakeCode.pr("fp_add_dump_output(${LF_MAIN_TARGET})"); - cMakeCode.newLine(); - cMakeCode.pr("# .mem contains the program as a hex file"); - cMakeCode.pr("fp_add_mem_output(${LF_MAIN_TARGET})"); - cMakeCode.newLine(); - - cMakeCode.pr("# Verify that FlexPRET has the number of requested workers"); - cMakeCode.pr("# That information is available in the SDK's hwconfig"); - cMakeCode.pr("include($ENV{FP_SDK_PATH}/flexpret/hwconfig.cmake)"); - cMakeCode.pr("math(EXPR FLEXPRET_AVAILABLE_WORKERS \"${THREADS} - 1\")"); - cMakeCode.pr("if (${NUMBER_OF_WORKERS} GREATER ${FLEXPRET_AVAILABLE_WORKERS})"); - cMakeCode.indent(); - cMakeCode.pr("message(FATAL_ERROR \"Number of requested workers (${NUMBER_OF_WORKERS}) is higher than FlexPRET's number of available workers (${FLEXPRET_AVAILABLE_WORKERS}). Note that FlexPRET uses hardware threads, not the usual software threads.\")"); - cMakeCode.unindent(); - cMakeCode.pr("endif()"); + cMakeCode.pr("fp_add_outputs(${LF_MAIN_TARGET})"); cMakeCode.newLine(); break; } diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index eb797206c7..cacaff12b0 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit eb797206c781d956a2b7fcb8d06a1327e66996b5 +Subproject commit cacaff12b0ce5b387df062bae6769b8677127693 From cb9e16304c9ffc6fff8d80528b6499190db45c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Wed, 24 Apr 2024 02:02:56 +0200 Subject: [PATCH 05/42] Add custom install for FlexPRET; add validation for FlexPRET. --- .../lflang/generator/c/CCmakeGenerator.java | 24 ++++++++-- .../target/property/PlatformProperty.java | 48 ++++++++++++++++++- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index c9879c5bf6..1349f92a17 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -445,9 +445,27 @@ CodeBuilder generateCMakeCode( cMakeCode.newLine(); } - // Add the install option - cMakeCode.pr(installCode); - cMakeCode.newLine(); + if (platformOptions.platform() == Platform.FLEXPRET) { + cMakeCode.pr(""" + # FlexPRET SDK generates a script that runs the program; + # install it to the top-level bin + install( + FILES ${CMAKE_SOURCE_DIR}/bin/${LF_MAIN_TARGET} + DESTINATION ${CMAKE_INSTALL_BINDIR} + PERMISSIONS + OWNER_EXECUTE # Need execute, the others are normal permissions + OWNER_READ + OWNER_WRITE + GROUP_READ + WORLD_READ + ) + """); + cMakeCode.newLine(); + } else { + // Add the install option + cMakeCode.pr(installCode); + cMakeCode.newLine(); + } // Add the include file for (String includeFile : targetConfig.getOrDefault(CmakeIncludeProperty.INSTANCE)) { diff --git a/core/src/main/java/org/lflang/target/property/PlatformProperty.java b/core/src/main/java/org/lflang/target/property/PlatformProperty.java index 71b9fbbf1f..8623e2ccac 100644 --- a/core/src/main/java/org/lflang/target/property/PlatformProperty.java +++ b/core/src/main/java/org/lflang/target/property/PlatformProperty.java @@ -6,6 +6,7 @@ import org.lflang.lf.KeyValuePair; import org.lflang.lf.KeyValuePairs; import org.lflang.lf.LfFactory; +import org.lflang.lf.Literal; import org.lflang.lf.LfPackage.Literals; import org.lflang.target.TargetConfig; import org.lflang.target.property.PlatformProperty.PlatformOptions; @@ -13,6 +14,9 @@ import org.lflang.target.property.type.DictionaryType.DictionaryElement; import org.lflang.target.property.type.PlatformType; import org.lflang.target.property.type.PlatformType.Platform; + +import com.google.inject.spi.Message; + import org.lflang.target.property.type.PrimitiveType; import org.lflang.target.property.type.TargetPropertyType; import org.lflang.target.property.type.UnionType; @@ -74,11 +78,51 @@ protected PlatformOptions fromString(String string, MessageReporter reporter) { @Override 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; + default: + break; + } + } + + private void validateRP2040(TargetConfig config, MessageReporter reporter) { var singleThreaded = config.get(SingleThreadedProperty.INSTANCE); - if (!singleThreaded && config.get(PlatformProperty.INSTANCE).platform == Platform.RP2040) { + 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(); + if (board != null) { + if (!board.equals("emulator") && !board.equals("fpga")) { + reporter .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) - .error("Platform " + Platform.RP2040 + " does not support threading."); + .error("Only \"emulator\" and \"fpga\" are valid options for board property. Got " + board + "."); + } + + // Do validation specific to emulator + if (board.equals("emulator")) { + if (platform.port() != null) { + reporter + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .warning("Port property ignored for emulator"); + } + if (platform.flash() == true) { + reporter + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .warning("Flash property ignored for emulator"); + } // TODO: Add check on baudrate not set + } } } From d492a00beefa9078fc2a79e1dd78155284655f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Thu, 25 Apr 2024 03:11:52 +0200 Subject: [PATCH 06/42] Add check on default value for and PlatformOptions. Also add FlexPRETUtil.java that contains a function to flash an executable to FlexPRET FPGA. --- .../lflang/generator/c/CCmakeGenerator.java | 2 +- .../org/lflang/generator/c/CCompiler.java | 2 +- .../target/property/PlatformProperty.java | 81 +++++++++++++++---- .../java/org/lflang/util/ArduinoUtil.java | 2 +- .../java/org/lflang/util/FlexPRETUtil.java | 50 ++++++++++++ core/src/main/resources/lib/c/reactor-c | 2 +- 6 files changed, 121 insertions(+), 18 deletions(-) create mode 100644 core/src/main/java/org/lflang/util/FlexPRETUtil.java diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index 1349f92a17..8288f8ecf0 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -607,7 +607,7 @@ private static String setUpMainTargetFlexPRET( code.pr(")"); code.newLine(); - code.pr("target_link_libraries(${LF_MAIN_TARGET} PUBLIC fp-sdk)"); + code.pr("target_link_libraries(${LF_MAIN_TARGET} PRIVATE fp-sdk)"); code.newLine(); return code.toString(); diff --git a/core/src/main/java/org/lflang/generator/c/CCompiler.java b/core/src/main/java/org/lflang/generator/c/CCompiler.java index c0401b5684..cd4668ec73 100644 --- a/core/src/main/java/org/lflang/generator/c/CCompiler.java +++ b/core/src/main/java/org/lflang/generator/c/CCompiler.java @@ -178,7 +178,7 @@ public boolean runCCompiler(GeneratorBase generator, LFGeneratorContext context) + " finished with no errors."); } var options = targetConfig.getOrDefault(PlatformProperty.INSTANCE); - if (options.platform() == Platform.ZEPHYR && options.flash()) { + if (options.platform() == Platform.ZEPHYR && options.flash().value()) { messageReporter.nowhere().info("Invoking flash command for Zephyr"); LFCommand flash = buildWestFlashCommand(options); int flashRet = flash.run(); diff --git a/core/src/main/java/org/lflang/target/property/PlatformProperty.java b/core/src/main/java/org/lflang/target/property/PlatformProperty.java index 8623e2ccac..9956d6c75f 100644 --- a/core/src/main/java/org/lflang/target/property/PlatformProperty.java +++ b/core/src/main/java/org/lflang/target/property/PlatformProperty.java @@ -6,7 +6,6 @@ import org.lflang.lf.KeyValuePair; import org.lflang.lf.KeyValuePairs; import org.lflang.lf.LfFactory; -import org.lflang.lf.Literal; import org.lflang.lf.LfPackage.Literals; import org.lflang.target.TargetConfig; import org.lflang.target.property.PlatformProperty.PlatformOptions; @@ -15,8 +14,6 @@ import org.lflang.target.property.type.PlatformType; import org.lflang.target.property.type.PlatformType.Platform; -import com.google.inject.spi.Message; - import org.lflang.target.property.type.PrimitiveType; import org.lflang.target.property.type.TargetPropertyType; import org.lflang.target.property.type.UnionType; @@ -36,7 +33,10 @@ private PlatformProperty() { @Override public PlatformOptions initialValue() { - return new PlatformOptions(Platform.AUTO, null, null, 9600, false, 0); + FlashOption flash = new FlashOption(false, false); + BaudRateOption baudRate = new BaudRateOption(false, 0); + + return new PlatformOptions(Platform.AUTO, null, null, baudRate, flash, 0); } @Override @@ -44,8 +44,12 @@ public PlatformOptions fromAst(Element node, MessageReporter reporter) { var platform = Platform.AUTO; String board = null; String port = null; - var baudRate = 9600; - var flash = false; + + int baudRateValue = 0; // Default value + boolean baudRateSet = false; + + boolean flashValue = false; + boolean flashSet = false; var userThreads = 0; if (node.getLiteral() != null || node.getId() != null) { platform = new PlatformType().forName(ASTUtils.elementToSingleString(node)); @@ -59,15 +63,25 @@ public PlatformOptions fromAst(Element node, MessageReporter reporter) { platform = new PlatformType().forName(ASTUtils.elementToSingleString(entry.getValue())); } - case BAUDRATE -> baudRate = ASTUtils.toInteger(entry.getValue()); + case BAUDRATE -> { + baudRateSet = true; + baudRateValue = ASTUtils.toInteger(entry.getValue()); + } case BOARD -> board = ASTUtils.elementToSingleString(entry.getValue()); - case FLASH -> flash = ASTUtils.toBoolean(entry.getValue()); + case FLASH -> { + flashSet = true; + flashValue = ASTUtils.toBoolean(entry.getValue()); + } case PORT -> port = ASTUtils.elementToSingleString(entry.getValue()); case USER_THREADS -> userThreads = ASTUtils.toInteger(entry.getValue()); } } } } + + FlashOption flash = new FlashOption(flashSet, flashValue); + BaudRateOption baudRate = new BaudRateOption(baudRateSet, baudRateValue); + return new PlatformOptions(platform, board, port, baudRate, flash, userThreads); } @@ -117,11 +131,22 @@ private void validateFlexPRET(TargetConfig config, MessageReporter reporter) { .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) .warning("Port property ignored for emulator"); } - if (platform.flash() == true) { + if (platform.flash().setByUser()) { reporter .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) .warning("Flash property ignored for emulator"); - } // TODO: Add check on baudrate not set + } + if (platform.baudRate().setByUser()) { + reporter + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .warning("Baudrate property ignored for emulator"); + } + } else { + if (platform.baudRate().setByUser()) { + reporter + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .error("Baudrate property is entirely controlled by FlexPRET's SDK and cannot be set by the user"); + } } } } @@ -135,9 +160,9 @@ public Element toAstElement(PlatformOptions value) { pair.setName(opt.toString()); switch (opt) { case NAME -> pair.setValue(ASTUtils.toElement(value.platform.toString())); - case BAUDRATE -> pair.setValue(ASTUtils.toElement(value.baudRate)); + case BAUDRATE -> pair.setValue(ASTUtils.toElement(value.baudRate().value())); case BOARD -> pair.setValue(ASTUtils.toElement(value.board)); - case FLASH -> pair.setValue(ASTUtils.toElement(value.flash)); + case FLASH -> pair.setValue(ASTUtils.toElement(value.flash().value())); case PORT -> pair.setValue(ASTUtils.toElement(value.port)); case USER_THREADS -> pair.setValue(ASTUtils.toElement(value.userThreads)); } @@ -155,6 +180,34 @@ public String name() { return "platform"; } + /** + * The purpose of this record is to keep track of whether the flash option + * was set by the user or is a default value. This is useful for producing + * warnings or errors. + */ + public record FlashOption( + /** + * Whether the user set the option + */ + boolean setByUser, + + /** + * The value (either set by the user or a default value) + */ + boolean value) {} + + /** Same reasoning as FlashOption */ + public record BaudRateOption( + /** + * Whether the user set the option + */ + boolean setByUser, + + /** + * The value (either set by the user or a default value) + */ + int value) {} + /** Settings related to Platform Options. */ public record PlatformOptions( /** @@ -180,13 +233,13 @@ public record PlatformOptions( * The baud rate used as a parameter to certain embedded platforms. 9600 is a standard rate * amongst systems like Arduino, so it's the default value. */ - int baudRate, + BaudRateOption baudRate, /** * Whether we should automatically attempt to flash once we compile. This may require the use * of board and port values depending on the infrastructure you use to flash the boards. */ - boolean flash, + FlashOption flash, /** * The number of threads requested by the user. diff --git a/core/src/main/java/org/lflang/util/ArduinoUtil.java b/core/src/main/java/org/lflang/util/ArduinoUtil.java index 00d11431be..50307159c9 100644 --- a/core/src/main/java/org/lflang/util/ArduinoUtil.java +++ b/core/src/main/java/org/lflang/util/ArduinoUtil.java @@ -109,7 +109,7 @@ public void buildArduino(FileConfig fileConfig, TargetConfig targetConfig) { "SUCCESS: Compiling generated code for " + fileConfig.name + " finished with no errors."); - if (targetConfig.get(PlatformProperty.INSTANCE).flash()) { + if (targetConfig.get(PlatformProperty.INSTANCE).flash().value()) { if (targetConfig.get(PlatformProperty.INSTANCE).port() != null) { messageReporter.nowhere().info("Invoking flash command for Arduino"); LFCommand flash = diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java new file mode 100644 index 0000000000..3d6cd264bf --- /dev/null +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -0,0 +1,50 @@ +package org.lflang.util; + +import java.io.IOException; +import java.util.Collections; + +import org.eclipse.xtext.xbase.lib.Exceptions; +import org.lflang.FileConfig; +import org.lflang.MessageReporter; +import org.lflang.generator.GeneratorCommandFactory; +import org.lflang.generator.LFGeneratorContext; + +public class FlexPRETUtil { + private LFGeneratorContext context; + private GeneratorCommandFactory commandFactory; + private MessageReporter messageReporter; + + public FlexPRETUtil( + LFGeneratorContext context, + GeneratorCommandFactory commandFactory, + MessageReporter messageReporter) { + this.context = context; + this.commandFactory = commandFactory; + this.messageReporter = messageReporter; + } + + public void flashTarget(FileConfig fileConfig) { + var binPath = fileConfig.binPath; + var exeName = fileConfig.name; + + /** + * FlexPRET's SDK generates a runnable bash script that flashes the + * software to FPGA. We just need to call it. + */ + var cmd = "./" + binPath + "/" + exeName; + var args = Collections. emptyList(); + + try { + LFCommand flash = commandFactory.createCommand(cmd, args); + int ret = flash.run(context.getCancelIndicator()); + if (ret != 0) { + messageReporter + .nowhere() + .error("Command " + cmd + " failed with exit code: " + ret); + throw new IOException("Could not flash"); + } + } catch (IOException e) { + Exceptions.sneakyThrow(e); + } + } +} diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index cacaff12b0..74fc6015d7 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit cacaff12b0ce5b387df062bae6769b8677127693 +Subproject commit 74fc6015d7dc6d1274ee041d1c8935bd42c5febc From 1a9510aa6bc76dce191bb62a1203967fa5b3909a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Wed, 1 May 2024 13:55:58 +0200 Subject: [PATCH 07/42] Use Option for PlatformOptions and change code to be compatible with this change. --- .../lflang/generator/c/CCmakeGenerator.java | 27 ++-- .../org/lflang/generator/c/CCompiler.java | 6 +- .../org/lflang/generator/c/CGenerator.java | 14 +- .../target/property/PlatformProperty.java | 123 ++++++++++-------- .../java/org/lflang/util/ArduinoUtil.java | 10 +- .../java/org/lflang/tests/Configurators.java | 9 +- 6 files changed, 104 insertions(+), 85 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index 8288f8ecf0..d2f3446d54 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -40,6 +40,7 @@ import org.lflang.target.property.CompileDefinitionsProperty; import org.lflang.target.property.CompilerProperty; import org.lflang.target.property.PlatformProperty; +import org.lflang.target.property.PlatformProperty.Option; import org.lflang.target.property.ProtobufsProperty; import org.lflang.target.property.SingleThreadedProperty; import org.lflang.target.property.WorkersProperty; @@ -127,8 +128,8 @@ CodeBuilder generateCMakeCode( // arduino String[] boardProperties = {}; var platformOptions = targetConfig.getOrDefault(PlatformProperty.INSTANCE); - if (platformOptions.board() != null) { - boardProperties = platformOptions.board().trim().split(":"); + if (platformOptions.board().setByUser()) { + boardProperties = platformOptions.board().value().trim().split(":"); // Ignore whitespace for (int i = 0; i < boardProperties.length; i++) { boardProperties[i] = boardProperties[i].trim(); @@ -149,9 +150,9 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("if(EXISTS prj.conf)"); cMakeCode.pr(" set(OVERLAY_CONFIG prj.conf)"); cMakeCode.pr("endif()"); - if (platformOptions.board() != null) { + if (platformOptions.board().setByUser()) { cMakeCode.pr("# Selecting board specified in target property"); - cMakeCode.pr("set(BOARD " + platformOptions.board() + ")"); + cMakeCode.pr("set(BOARD " + platformOptions.board().value() + ")"); } else { cMakeCode.pr("# Selecting default board"); cMakeCode.pr("set(BOARD qemu_cortex_m3)"); @@ -187,7 +188,7 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("project(" + executableName + " LANGUAGES C CXX ASM)"); cMakeCode.newLine(); // board type for rp2040 based boards - if (platformOptions.board() != null) { + if (platformOptions.board().setByUser()) { if (boardProperties.length < 1 || boardProperties[0].equals("")) { cMakeCode.pr("set(PICO_BOARD pico)"); } else { @@ -214,17 +215,17 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("Project(" + executableName + " LANGUAGES C ASM)"); cMakeCode.newLine(); - String selectedBoard = platformOptions.board(); - if (selectedBoard != null) { + Option selectedBoard = platformOptions.board(); + if (selectedBoard.setByUser()) { cMakeCode.pr("# Board selected from target property"); - cMakeCode.pr("set(TARGET " + selectedBoard + ")"); + cMakeCode.pr("set(TARGET " + selectedBoard.value() + ")"); cMakeCode.newLine(); } // No TARGET will automatically become emulator - var selectedFlashDevice = platformOptions.port(); - if (selectedFlashDevice != null) { + Option selectedFlashDevice = platformOptions.port(); + if (selectedFlashDevice.setByUser()) { cMakeCode.pr("# Flash device selected from target property"); - cMakeCode.pr("set(FP_FLASH_DEVICE " + selectedFlashDevice + ")"); + cMakeCode.pr("set(FP_FLASH_DEVICE " + selectedFlashDevice.value() + ")"); cMakeCode.newLine(); } // No FP_FLASH_DEVICE will automatically become /dev/ttyUSB0 @@ -359,7 +360,7 @@ CodeBuilder generateCMakeCode( // set stdio output boolean usb = true; boolean uart = true; - if (platformOptions.board() != null && boardProperties.length > 1) { + if (platformOptions.board().setByUser() && boardProperties.length > 1) { uart = !boardProperties[1].equals("usb"); usb = !boardProperties[1].equals("uart"); } @@ -372,6 +373,8 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("fp_add_outputs(${LF_MAIN_TARGET})"); cMakeCode.newLine(); break; + default: + break; } if (targetConfig.get(AuthProperty.INSTANCE)) { diff --git a/core/src/main/java/org/lflang/generator/c/CCompiler.java b/core/src/main/java/org/lflang/generator/c/CCompiler.java index cd4668ec73..8a3c418849 100644 --- a/core/src/main/java/org/lflang/generator/c/CCompiler.java +++ b/core/src/main/java/org/lflang/generator/c/CCompiler.java @@ -42,6 +42,7 @@ import org.lflang.target.property.CompilerProperty; import org.lflang.target.property.PlatformProperty; import org.lflang.target.property.PlatformProperty.PlatformOptions; +import org.lflang.target.property.PlatformProperty.Option; import org.lflang.target.property.TracePluginProperty; import org.lflang.target.property.type.BuildTypeType.BuildType; import org.lflang.target.property.type.PlatformType.Platform; @@ -319,9 +320,10 @@ public LFCommand buildCmakeCommand() { public LFCommand buildWestFlashCommand(PlatformOptions options) { // Set the build directory to be "build" Path buildPath = fileConfig.getSrcGenPath().resolve("build"); - String board = options.board(); + Option board = options.board(); + String boardValue = board.value(); LFCommand cmd; - if (board == null || board.startsWith("qemu") || board.equals("native_posix")) { + if (!board.setByUser() || boardValue.startsWith("qemu") || boardValue.equals("native_posix")) { cmd = commandFactory.createCommand("west", List.of("build", "-t", "run"), buildPath); } else { cmd = commandFactory.createCommand("west", List.of("flash"), buildPath); diff --git a/core/src/main/java/org/lflang/generator/c/CGenerator.java b/core/src/main/java/org/lflang/generator/c/CGenerator.java index eb3a21dc26..b36f2bbc5f 100644 --- a/core/src/main/java/org/lflang/generator/c/CGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CGenerator.java @@ -1981,7 +1981,7 @@ protected void setUpGeneralParameters() { final var platformOptions = targetConfig.get(PlatformProperty.INSTANCE); if (!targetConfig.get(SingleThreadedProperty.INSTANCE) && platformOptions.platform() == Platform.ARDUINO - && (platformOptions.board() == null || !platformOptions.board().contains("mbed"))) { + && (!platformOptions.board().setByUser() || !platformOptions.board().value().contains("mbed"))) { // non-MBED boards should not use threading messageReporter .nowhere() @@ -1993,7 +1993,7 @@ protected void setUpGeneralParameters() { if (platformOptions.platform() == Platform.ARDUINO && !targetConfig.get(NoCompileProperty.INSTANCE) - && platformOptions.board() == null) { + && !platformOptions.board().setByUser()) { messageReporter .nowhere() .info( @@ -2006,16 +2006,10 @@ protected void setUpGeneralParameters() { if (platformOptions.platform() == Platform.ZEPHYR && !targetConfig.get(SingleThreadedProperty.INSTANCE) - && platformOptions.userThreads() >= 0) { + && platformOptions.userThreads().value() >= 0) { targetConfig .get(CompileDefinitionsProperty.INSTANCE) - .put(PlatformOption.USER_THREADS.name(), String.valueOf(platformOptions.userThreads())); - } else if (platformOptions.userThreads() > 0) { - messageReporter - .nowhere() - .warning( - "Specifying user threads is only for threaded Lingua Franca on the Zephyr platform." - + " This option will be ignored."); // FIXME: do this during validation instead + .put(PlatformOption.USER_THREADS.name(), String.valueOf(platformOptions.userThreads().value())); } pickCompilePlatform(); } diff --git a/core/src/main/java/org/lflang/target/property/PlatformProperty.java b/core/src/main/java/org/lflang/target/property/PlatformProperty.java index 9956d6c75f..f3b89f8a38 100644 --- a/core/src/main/java/org/lflang/target/property/PlatformProperty.java +++ b/core/src/main/java/org/lflang/target/property/PlatformProperty.java @@ -33,24 +33,34 @@ private PlatformProperty() { @Override public PlatformOptions initialValue() { - FlashOption flash = new FlashOption(false, false); - BaudRateOption baudRate = new BaudRateOption(false, 0); + Option board = new Option(false, null); + Option port = new Option(false, null); + Option baudRate = new Option(false, 0); + Option flash = new Option(false, false); + Option userThreads = new Option(false, 0); - return new PlatformOptions(Platform.AUTO, null, null, baudRate, flash, 0); + return new PlatformOptions(Platform.AUTO, board, port, baudRate, flash, userThreads); } @Override public PlatformOptions fromAst(Element node, MessageReporter reporter) { var platform = Platform.AUTO; - String board = null; - String port = null; + + String boardValue = null; + boolean boardSet = false; + + String portValue = null; + boolean portSet = false; - int baudRateValue = 0; // Default value + int baudRateValue = 0; boolean baudRateSet = false; boolean flashValue = false; boolean flashSet = false; - var userThreads = 0; + + int userThreadsValue = 0; + boolean userThreadsSet = false; + if (node.getLiteral() != null || node.getId() != null) { platform = new PlatformType().forName(ASTUtils.elementToSingleString(node)); } else if (node.getKeyvalue() != null) { @@ -67,20 +77,32 @@ public PlatformOptions fromAst(Element node, MessageReporter reporter) { baudRateSet = true; baudRateValue = ASTUtils.toInteger(entry.getValue()); } - case BOARD -> board = ASTUtils.elementToSingleString(entry.getValue()); + case BOARD -> { + boardSet = true; + boardValue = ASTUtils.elementToSingleString(entry.getValue()); + } case FLASH -> { flashSet = true; flashValue = ASTUtils.toBoolean(entry.getValue()); } - case PORT -> port = ASTUtils.elementToSingleString(entry.getValue()); - case USER_THREADS -> userThreads = ASTUtils.toInteger(entry.getValue()); + case PORT -> { + portSet = true; + portValue = ASTUtils.elementToSingleString(entry.getValue()); + } + case USER_THREADS -> { + userThreadsSet = true; + userThreadsValue = ASTUtils.toInteger(entry.getValue()); + } } } } } - FlashOption flash = new FlashOption(flashSet, flashValue); - BaudRateOption baudRate = new BaudRateOption(baudRateSet, baudRateValue); + Option board = new Option(boardSet, boardValue); + Option port = new Option(portSet, portValue); + Option baudRate = new Option(baudRateSet, baudRateValue); + Option flash = new Option(flashSet, flashValue); + Option userThreads = new Option(userThreadsSet, userThreadsValue); return new PlatformOptions(platform, board, port, baudRate, flash, userThreads); } @@ -100,6 +122,9 @@ public void validate(TargetConfig config, MessageReporter reporter) { case FLEXPRET: validateFlexPRET(config, reporter); break; + case ZEPHYR: + validateZephyr(config, reporter); + break; default: break; } @@ -117,16 +142,16 @@ private void validateRP2040(TargetConfig config, MessageReporter reporter) { private void validateFlexPRET(TargetConfig config, MessageReporter reporter) { var platform = config.get(PlatformProperty.INSTANCE); var board = platform.board(); - if (board != null) { - if (!board.equals("emulator") && !board.equals("fpga")) { + if (board.setByUser()) { + if (!board.value().equals("emulator") && !board.value().equals("fpga")) { reporter .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) .error("Only \"emulator\" and \"fpga\" are valid options for board property. Got " + board + "."); } // Do validation specific to emulator - if (board.equals("emulator")) { - if (platform.port() != null) { + if (board.value().equals("emulator")) { + if (platform.port().setByUser()) { reporter .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) .warning("Port property ignored for emulator"); @@ -151,6 +176,21 @@ private void validateFlexPRET(TargetConfig config, MessageReporter reporter) { } } + private void validateZephyr(TargetConfig config, MessageReporter reporter) { + var platform = config.get(PlatformProperty.INSTANCE); + var singleThreaded = config.get(SingleThreadedProperty.INSTANCE); + + if (singleThreaded) { + if (platform.userThreads().value() > 0) { + reporter + .nowhere() + .warning( + "Specifying user threads is only for threaded Lingua Franca on the Zephyr platform." + + " This option will be ignored."); + } + } + } + @Override public Element toAstElement(PlatformOptions value) { Element e = LfFactory.eINSTANCE.createElement(); @@ -160,11 +200,11 @@ public Element toAstElement(PlatformOptions value) { pair.setName(opt.toString()); switch (opt) { case NAME -> pair.setValue(ASTUtils.toElement(value.platform.toString())); - case BAUDRATE -> pair.setValue(ASTUtils.toElement(value.baudRate().value())); - case BOARD -> pair.setValue(ASTUtils.toElement(value.board)); - case FLASH -> pair.setValue(ASTUtils.toElement(value.flash().value())); - case PORT -> pair.setValue(ASTUtils.toElement(value.port)); - case USER_THREADS -> pair.setValue(ASTUtils.toElement(value.userThreads)); + case BAUDRATE -> pair.setValue(ASTUtils.toElement(value.baudRate.value)); + case BOARD -> pair.setValue(ASTUtils.toElement(value.board.value)); + case FLASH -> pair.setValue(ASTUtils.toElement(value.flash.value)); + case PORT -> pair.setValue(ASTUtils.toElement(value.port.value)); + case USER_THREADS -> pair.setValue(ASTUtils.toElement(value.userThreads.value)); } kvp.getPairs().add(pair); } @@ -181,32 +221,10 @@ public String name() { } /** - * The purpose of this record is to keep track of whether the flash option - * was set by the user or is a default value. This is useful for producing - * warnings or errors. + * Keep track of whether a value was set by user or not. + * */ - public record FlashOption( - /** - * Whether the user set the option - */ - boolean setByUser, - - /** - * The value (either set by the user or a default value) - */ - boolean value) {} - - /** Same reasoning as FlashOption */ - public record BaudRateOption( - /** - * Whether the user set the option - */ - boolean setByUser, - - /** - * The value (either set by the user or a default value) - */ - int value) {} + public record Option(boolean setByUser, T value) {} /** Settings related to Platform Options. */ public record PlatformOptions( @@ -215,36 +233,37 @@ public record PlatformOptions( * developing for specific OS/Embedded Platform */ Platform platform, + /** * The string value used to determine what type of embedded board we work with and can be used * to simplify the build process. This string has the form "board_name[:option]*" (zero or * more options separated by colons). For example, "pico:usb" specifies a Raspberry Pi Pico * where stdin and stdout go through a USB serial port. */ - String board, + Option board, /** * The string value used to determine the port on which to flash the compiled program (i.e. * /dev/cu.usbmodem21301) */ - String port, + Option port, /** * The baud rate used as a parameter to certain embedded platforms. 9600 is a standard rate * amongst systems like Arduino, so it's the default value. */ - BaudRateOption baudRate, + Option baudRate, /** * Whether we should automatically attempt to flash once we compile. This may require the use * of board and port values depending on the infrastructure you use to flash the boards. */ - FlashOption flash, + Option flash, /** * The number of threads requested by the user. */ - int userThreads) { + Option userThreads) { public String[] boardArray() { // Parse board option of the platform target property @@ -254,7 +273,7 @@ public String[] boardArray() { // arduino String[] boardProperties = {}; if (this.board != null) { - boardProperties = this.board.trim().split(":"); + boardProperties = this.board.value.trim().split(":"); // Ignore whitespace for (int i = 0; i < boardProperties.length; i++) { boardProperties[i] = boardProperties[i].trim(); diff --git a/core/src/main/java/org/lflang/util/ArduinoUtil.java b/core/src/main/java/org/lflang/util/ArduinoUtil.java index 50307159c9..b811cc8d01 100644 --- a/core/src/main/java/org/lflang/util/ArduinoUtil.java +++ b/core/src/main/java/org/lflang/util/ArduinoUtil.java @@ -57,12 +57,12 @@ private LFCommand arduinoCompileCommand(FileConfig fileConfig, TargetConfig targ var srcGenPath = fileConfig.getSrcGenPath(); String board = - targetConfig.get(PlatformProperty.INSTANCE).board() != null - ? targetConfig.get(PlatformProperty.INSTANCE).board() + targetConfig.get(PlatformProperty.INSTANCE).board().setByUser() + ? targetConfig.get(PlatformProperty.INSTANCE).board().value() : "arduino:avr:leonardo"; String compileDefs = - (targetConfig.get(PlatformProperty.INSTANCE).board().contains("mbed") + (targetConfig.get(PlatformProperty.INSTANCE).board().value().contains("mbed") ? "" : "-DLF_SINGLE_THREADED") + " -DPLATFORM_ARDUINO" @@ -118,9 +118,9 @@ public void buildArduino(FileConfig fileConfig, TargetConfig targetConfig) { List.of( "upload", "-b", - targetConfig.get(PlatformProperty.INSTANCE).board(), + targetConfig.get(PlatformProperty.INSTANCE).board().value(), "-p", - targetConfig.get(PlatformProperty.INSTANCE).port()), + targetConfig.get(PlatformProperty.INSTANCE).port().value()), fileConfig.getSrcGenPath()); if (flash == null) { messageReporter.nowhere().error("Could not create arduino-cli flash command."); diff --git a/core/src/testFixtures/java/org/lflang/tests/Configurators.java b/core/src/testFixtures/java/org/lflang/tests/Configurators.java index aed02e9d31..72ea78ed38 100644 --- a/core/src/testFixtures/java/org/lflang/tests/Configurators.java +++ b/core/src/testFixtures/java/org/lflang/tests/Configurators.java @@ -28,6 +28,7 @@ import org.lflang.target.property.LoggingProperty; import org.lflang.target.property.PlatformProperty; import org.lflang.target.property.PlatformProperty.PlatformOptions; +import org.lflang.target.property.PlatformProperty.Option; import org.lflang.target.property.SingleThreadedProperty; import org.lflang.target.property.WorkersProperty; import org.lflang.target.property.type.LoggingType.LogLevel; @@ -79,10 +80,10 @@ public static boolean makeZephyrCompatibleUnthreaded(TargetConfig config) { config, new PlatformOptions( Platform.ZEPHYR, - "qemu_cortex_m3", + new Option(true, "qemu_cortex_m3"), platform.port(), platform.baudRate(), - false, + new Option(true, false), platform.userThreads())); return true; } @@ -96,10 +97,10 @@ public static boolean makeZephyrCompatible(TargetConfig config) { config, new PlatformOptions( Platform.ZEPHYR, - "qemu_cortex_m3", + new Option(true, "qemu_cortex_m3"), platform.port(), platform.baudRate(), - false, + new Option(true, false), platform.userThreads())); return true; } From dde2b8886d95ed0ad189d2d01a71d963bf909860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Wed, 1 May 2024 15:14:24 +0200 Subject: [PATCH 08/42] Add execution of generated bash script at end of lfc. Currently does not print anything during execution, which it should --- .../org/lflang/generator/c/CGenerator.java | 8 +++++++ .../java/org/lflang/util/FlexPRETUtil.java | 22 ++++++++++++------- .../main/java/org/lflang/util/LFCommand.java | 5 +++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CGenerator.java b/core/src/main/java/org/lflang/generator/c/CGenerator.java index b36f2bbc5f..0aec893251 100644 --- a/core/src/main/java/org/lflang/generator/c/CGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CGenerator.java @@ -105,6 +105,7 @@ import org.lflang.target.property.type.SchedulerType.Scheduler; import org.lflang.util.ArduinoUtil; import org.lflang.util.FileUtil; +import org.lflang.util.FlexPRETUtil; /** * Generator for C target. This class generates C code defining each reactor class given in the @@ -446,6 +447,8 @@ public void doGenerate(Resource resource, LFGeneratorContext context) { var isArduino = targetConfig.getOrDefault(PlatformProperty.INSTANCE).platform() == Platform.ARDUINO; + var isFlexPRET = + targetConfig.getOrDefault(PlatformProperty.INSTANCE).platform() == Platform.FLEXPRET; // If cmake is requested, generate the CMakeLists.txt if (!isArduino) { @@ -552,6 +555,11 @@ public void doGenerate(Resource resource, LFGeneratorContext context) { context.finish(GeneratorResult.Status.COMPILED, null); } } + if (isFlexPRET) { + // TODO: Check if fpga and flash set + FlexPRETUtil flexPRETUtil = new FlexPRETUtil(context, commandFactory, messageReporter); + flexPRETUtil.flashTarget(fileConfig); + } } } diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index 3d6cd264bf..6ebdbe30c1 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -29,22 +29,28 @@ public void flashTarget(FileConfig fileConfig) { /** * FlexPRET's SDK generates a runnable bash script that flashes the - * software to FPGA. We just need to call it. + * software to FPGA. We just need to run it. */ - var cmd = "./" + binPath + "/" + exeName; + var cmd = binPath + "/" + exeName; var args = Collections. emptyList(); try { + commandFactory.setVerbose(); LFCommand flash = commandFactory.createCommand(cmd, args); - int ret = flash.run(context.getCancelIndicator()); - if (ret != 0) { - messageReporter - .nowhere() - .error("Command " + cmd + " failed with exit code: " + ret); - throw new IOException("Could not flash"); + flash.setVerbose(); + if (flash != null) { + int ret = flash.run(context.getCancelIndicator()); + if (ret != 0) { + messageReporter + .nowhere() + .error("Command " + cmd + " failed with exit code: " + ret); + throw new IOException("Could not flash"); + } } } catch (IOException e) { Exceptions.sneakyThrow(e); + } catch (NullPointerException e) { + Exceptions.sneakyThrow(e); } } } diff --git a/core/src/main/java/org/lflang/util/LFCommand.java b/core/src/main/java/org/lflang/util/LFCommand.java index 8bed14916e..10e4cbb92d 100644 --- a/core/src/main/java/org/lflang/util/LFCommand.java +++ b/core/src/main/java/org/lflang/util/LFCommand.java @@ -232,6 +232,11 @@ public void setQuiet() { quiet = true; } + /** Require this to be verbose, overriding the verbosity specified at construction time. */ + public void setVerbose() { + quiet = false; + } + /** * Create a LFCommand instance from a given command and argument list in the current working * directory. From eb831ef4bbed268cef291ba2b4b821e77ab7dd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Thu, 2 May 2024 02:06:00 +0200 Subject: [PATCH 09/42] Remove warnings on unused variables in generated code; fix flash option for FlexPRET --- .../federated/extensions/CExtensionUtils.java | 30 +++++++++++++++++++ .../org/lflang/generator/c/CGenerator.java | 27 +++++++++++++---- .../java/org/lflang/util/FlexPRETUtil.java | 3 +- 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java b/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java index c5adf0a810..01e3acb15c 100644 --- a/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java +++ b/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java @@ -445,6 +445,21 @@ public static String generateFederateNeighborStructure(FederateInstance federate return code.toString(); } + public static String surroundWithIfElseFederated(String insideIf, String insideElse) { + if (insideElse == null) { + return surroundWithIfFederated(insideIf); + } else { + return """ + #ifdef FEDERATED + %s + #else + %s + #endif // FEDERATED + """ + .formatted(insideIf, insideElse); + } + } + /** * Surround {@code code} with blocks to ensure that code only executes if the program is * federated. @@ -458,6 +473,21 @@ public static String surroundWithIfFederated(String code) { .formatted(code); } + public static String surroundWithIfElseFederatedCentralized(String insideIf, String insideElse) { + if (insideElse == null) { + return surroundWithIfFederatedCentralized(insideIf); + } else { + return """ + #ifdef FEDERATED_CENTRALIZED + %s + #else + %s + #endif // FEDERATED_CENTRALIZED + """ + .formatted(insideIf, insideElse); + } + } + /** * Surround {@code code} with blocks to ensure that code only executes if the program is federated * and has a centralized coordination. diff --git a/core/src/main/java/org/lflang/generator/c/CGenerator.java b/core/src/main/java/org/lflang/generator/c/CGenerator.java index 0aec893251..f2409b4071 100644 --- a/core/src/main/java/org/lflang/generator/c/CGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CGenerator.java @@ -556,9 +556,21 @@ public void doGenerate(Resource resource, LFGeneratorContext context) { } } if (isFlexPRET) { - // TODO: Check if fpga and flash set - FlexPRETUtil flexPRETUtil = new FlexPRETUtil(context, commandFactory, messageReporter); - flexPRETUtil.flashTarget(fileConfig); + var platform = targetConfig.getOrDefault(PlatformProperty.INSTANCE); + if (platform.flash().value()) { + /** + * Flash will result in two widely different responses when board + * is set to `emulator` and `fpga`. For emulator, it will immediately + * run the emulator. For fpga, it will attempt to transfer the program + * to the fpga. + * + * It is FlexPRET's software development kit that handles all this; + * we just run the script it generates. But it will generate two + * widely different scripts. + */ + FlexPRETUtil flexPRETUtil = new FlexPRETUtil(context, commandFactory, messageReporter); + flexPRETUtil.flashTarget(fileConfig); + } } } } @@ -644,8 +656,9 @@ private void generateCodeFor(String lfModuleName) throws IOException { String.join( "\n", "void logical_tag_complete(tag_t tag_to_send) {", - CExtensionUtils.surroundWithIfFederatedCentralized( - " lf_latest_tag_complete(tag_to_send);"), + CExtensionUtils.surroundWithIfElseFederatedCentralized( + " lf_latest_tag_complete(tag_to_send);", + " (void) tag_to_send;"), "}")); // Generate an empty termination function for non-federated @@ -655,7 +668,9 @@ private void generateCodeFor(String lfModuleName) throws IOException { code.pr( """ #ifndef FEDERATED - void lf_terminate_execution(environment_t* env) {} + void lf_terminate_execution(environment_t* env) { + (void) env; + } #endif"""); } } diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index 6ebdbe30c1..2e5290aa9e 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -28,8 +28,7 @@ public void flashTarget(FileConfig fileConfig) { var exeName = fileConfig.name; /** - * FlexPRET's SDK generates a runnable bash script that flashes the - * software to FPGA. We just need to run it. + * FlexPRET's SDK generates a runnable bash script. We just need to run it. */ var cmd = binPath + "/" + exeName; var args = Collections. emptyList(); From ace655388916fbde4d9f0abb9446cf99de6d6c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Thu, 2 May 2024 03:23:38 +0200 Subject: [PATCH 10/42] Add tests for FlexPRET - concurrent is failing for some reason... --- .../java/org/lflang/tests/RuntimeTest.java | 5 +- .../lflang/tests/runtime/CFlexPRETTest.java | 80 +++++++++++++++++++ .../org/lflang/generator/c/CGenerator.java | 3 +- .../java/org/lflang/tests/Configurators.java | 28 +++++++ .../java/org/lflang/tests/TestRegistry.java | 1 + 5 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java diff --git a/core/src/integrationTest/java/org/lflang/tests/RuntimeTest.java b/core/src/integrationTest/java/org/lflang/tests/RuntimeTest.java index 12c71eed7c..2f170ec488 100644 --- a/core/src/integrationTest/java/org/lflang/tests/RuntimeTest.java +++ b/core/src/integrationTest/java/org/lflang/tests/RuntimeTest.java @@ -232,7 +232,7 @@ public static boolean compatibleWithThreadingOff(TestCategory category) { // CONCURRENT, FEDERATED, DOCKER_FEDERATED, DOCKER // are not compatible with single-threaded execution. - // ARDUINO and ZEPHYR have their own test suites, so we don't need to rerun. + // ARDUINO, ZEPHYR and FLEXPRET have their own test suites, so we don't need to rerun. boolean excluded = category == TestCategory.CONCURRENT || category == TestCategory.SERIALIZATION @@ -244,7 +244,8 @@ public static boolean compatibleWithThreadingOff(TestCategory category) { || category == TestCategory.VERIFIER || category == TestCategory.ZEPHYR_UNTHREADED || category == TestCategory.ZEPHYR_BOARDS - || category == TestCategory.ZEPHYR_THREADED; + || category == TestCategory.ZEPHYR_THREADED + || category == TestCategory.FLEXPRET; // SERIALIZATION and TARGET tests are excluded on Windows. excluded |= isWindows() && category == TestCategory.TARGET; diff --git a/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java b/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java new file mode 100644 index 0000000000..eaacb29229 --- /dev/null +++ b/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java @@ -0,0 +1,80 @@ +/************* + * Copyright (c) 2023, The University of California at Berkeley. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ***************/ +package org.lflang.tests.runtime; + +import java.util.List; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.Test; +import org.lflang.target.Target; +import org.lflang.tests.Configurators; +import org.lflang.tests.TestBase; +import org.lflang.tests.TestRegistry.TestCategory; +import org.lflang.tests.Transformers; + +public class CFlexPRETTest extends TestBase { + + public CFlexPRETTest() { + super(Target.C); + } + + @Test + public void buildFlexPRETConcurrent() { + Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); + super.runTestsFor( + List.of(Target.C), + "Build concurrent tests for FlexPRET.", + TestCategory.CONCURRENT::equals, + Transformers::noChanges, + Configurators::makeFlexPRETCompatible, + TestLevel.BUILD, + false); + } + + @Test + public void buildFlexPRETBasicTestsUnthreaded() { + Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); + super.runTestsFor( + List.of(Target.C), + "Build basic tests for FlexPRET in single threaded mode.", + TestCategory.BASIC::equals, + Transformers::noChanges, + Configurators::makeFlexPRETCompatibleUnthreaded, + TestLevel.BUILD, + false); + } + + @Test + public void buildFlexPRETBasicTests() { + Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); + super.runTestsFor( + List.of(Target.C), + "Build basic tests for FlexPRET.", + TestCategory.BASIC::equals, + Transformers::noChanges, + Configurators::makeFlexPRETCompatible, + TestLevel.BUILD, + false); + } +} diff --git a/core/src/main/java/org/lflang/generator/c/CGenerator.java b/core/src/main/java/org/lflang/generator/c/CGenerator.java index f2409b4071..119a4f908b 100644 --- a/core/src/main/java/org/lflang/generator/c/CGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CGenerator.java @@ -565,8 +565,7 @@ public void doGenerate(Resource resource, LFGeneratorContext context) { * to the fpga. * * It is FlexPRET's software development kit that handles all this; - * we just run the script it generates. But it will generate two - * widely different scripts. + * we just run the script it generates. */ FlexPRETUtil flexPRETUtil = new FlexPRETUtil(context, commandFactory, messageReporter); flexPRETUtil.flashTarget(fileConfig); diff --git a/core/src/testFixtures/java/org/lflang/tests/Configurators.java b/core/src/testFixtures/java/org/lflang/tests/Configurators.java index 72ea78ed38..cb48f55a8a 100644 --- a/core/src/testFixtures/java/org/lflang/tests/Configurators.java +++ b/core/src/testFixtures/java/org/lflang/tests/Configurators.java @@ -104,6 +104,34 @@ public static boolean makeZephyrCompatible(TargetConfig config) { platform.userThreads())); return true; } + + public static boolean makeFlexPRETCompatible(TargetConfig config) { + /** + * FlexPRET has a maximum of eight hardware threads; override the chosen + * number of worker threads to be 0 (meaning run-time selects it). + * + * This is to avoid failing tests that have e.g., `workers: 16`. + */ + WorkersProperty.INSTANCE.override(config, 0); + + var platform = config.get(PlatformProperty.INSTANCE); + PlatformProperty.INSTANCE.override( + config, + new PlatformOptions( + Platform.FLEXPRET, + new Option(true, "emulator"), + platform.port(), + platform.baudRate(), + new Option(true, false), + platform.userThreads())); + return true; + } + + public static boolean makeFlexPRETCompatibleUnthreaded(TargetConfig config) { + disableThreading(config); + return makeFlexPRETCompatible(config); + } + /** * Make no changes to the configuration. * diff --git a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java index 92876aa5f6..f0df742fa8 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java @@ -335,6 +335,7 @@ public enum TestCategory { ZEPHYR_THREADED(false, "zephyr" + File.separator + "threaded", TestLevel.BUILD), ZEPHYR_UNTHREADED(false, "zephyr" + File.separator + "unthreaded", TestLevel.BUILD), ZEPHYR_BOARDS(false, "zephyr" + File.separator + "boards", TestLevel.BUILD), + FLEXPRET(false, "flexpret", TestLevel.BUILD), VERIFIER(false, "verifier", TestLevel.EXECUTION), TARGET(false, "", TestLevel.EXECUTION); From 01fce3853345c7c852e29bd90f796c27874c4753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Thu, 2 May 2024 03:23:58 +0200 Subject: [PATCH 11/42] Update reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 74fc6015d7..3bd8a108d0 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 74fc6015d7dc6d1274ee041d1c8935bd42c5febc +Subproject commit 3bd8a108d078c58e881744d95ab42251116e334b From 6c30ff09ecf978d35e633e7a576d8e7d34e09816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Fri, 3 May 2024 02:59:02 +0200 Subject: [PATCH 12/42] Bump reactor-c so tests pass --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 3bd8a108d0..1afab5654c 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 3bd8a108d078c58e881744d95ab42251116e334b +Subproject commit 1afab5654c7f9690ae914bd2c813a5e5f7f8410d From cd8e023a0f4f05dfddb3854e163afc5fed91c5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Fri, 3 May 2024 15:11:22 +0200 Subject: [PATCH 13/42] Add info message when FP_SDK_FPGA_INTERFACE_PROGRAM is set because LF does not support [Y/n] interactive prompts in LFCommand. --- .../org/lflang/generator/c/CGenerator.java | 2 +- .../target/property/PlatformProperty.java | 5 --- .../java/org/lflang/util/FlexPRETUtil.java | 39 +++++++++++++++++-- core/src/main/resources/lib/c/reactor-c | 2 +- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CGenerator.java b/core/src/main/java/org/lflang/generator/c/CGenerator.java index 119a4f908b..158371bd9f 100644 --- a/core/src/main/java/org/lflang/generator/c/CGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CGenerator.java @@ -568,7 +568,7 @@ public void doGenerate(Resource resource, LFGeneratorContext context) { * we just run the script it generates. */ FlexPRETUtil flexPRETUtil = new FlexPRETUtil(context, commandFactory, messageReporter); - flexPRETUtil.flashTarget(fileConfig); + flexPRETUtil.flashTarget(fileConfig, targetConfig); } } } diff --git a/core/src/main/java/org/lflang/target/property/PlatformProperty.java b/core/src/main/java/org/lflang/target/property/PlatformProperty.java index f3b89f8a38..5991b6cce9 100644 --- a/core/src/main/java/org/lflang/target/property/PlatformProperty.java +++ b/core/src/main/java/org/lflang/target/property/PlatformProperty.java @@ -156,11 +156,6 @@ private void validateFlexPRET(TargetConfig config, MessageReporter reporter) { .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) .warning("Port property ignored for emulator"); } - if (platform.flash().setByUser()) { - reporter - .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) - .warning("Flash property ignored for emulator"); - } if (platform.baudRate().setByUser()) { reporter .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index 2e5290aa9e..328d5b1271 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -8,6 +8,8 @@ import org.lflang.MessageReporter; import org.lflang.generator.GeneratorCommandFactory; import org.lflang.generator.LFGeneratorContext; +import org.lflang.target.property.PlatformProperty; +import org.lflang.target.TargetConfig; public class FlexPRETUtil { private LFGeneratorContext context; @@ -23,7 +25,7 @@ public FlexPRETUtil( this.messageReporter = messageReporter; } - public void flashTarget(FileConfig fileConfig) { + public void flashTarget(FileConfig fileConfig, TargetConfig config) { var binPath = fileConfig.binPath; var exeName = fileConfig.name; @@ -34,9 +36,40 @@ public void flashTarget(FileConfig fileConfig) { var args = Collections. emptyList(); try { - commandFactory.setVerbose(); LFCommand flash = commandFactory.createCommand(cmd, args); - flash.setVerbose(); + + /** + * Check if environment variable FP_SDK_FPGA_INTERFACE_PROGRAM is set. + * If it is set, we should let the user know it is not supported by LF. + * + * We cannot support it because FP_SDK_FPGA_INTERFACE_PROGRAM will lead to + * a [Y/n] prompt, and the LFCommands do not have a way of getting the + * prompt response. + * + * When FP_SDK_FPGA_INTERFACE_PROGRAM is not set, there is no prompt. + */ + var envInterfaceProgram = System.getenv("FP_SDK_FPGA_INTERFACE_PROGRAM"); + + /** + * FP_SDK_FPGA_INTERFACE_PROGRAM is only relevant when the user has specified + * board = fpga and flash = true. So only print the info message if that + * is the case. + */ + var platform = config.get(PlatformProperty.INSTANCE); + var interfaceProgramRelevant = platform.board().value().equals("fpga") + && platform.flash().value() == true; + + if (interfaceProgramRelevant && envInterfaceProgram != null) { + messageReporter + .nowhere() + .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); + } + + /** + * Set the variable to nothing for the flash command, which will avoid the + * [Y/n] prompt + */ + flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); if (flash != null) { int ret = flash.run(context.getCancelIndicator()); if (ret != 0) { diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 1afab5654c..bd54f002c3 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 1afab5654c7f9690ae914bd2c813a5e5f7f8410d +Subproject commit bd54f002c307c6dd230260e14370131f1a2dd45c From f856e38dbbc30dbe328a1b61d52b778bb94eee33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Fri, 3 May 2024 16:49:31 +0200 Subject: [PATCH 14/42] Add CI tests. --- .github/actions/setup-flexpret/action.yml | 44 ++++++++++++++++++ .github/workflows/c-flexpret-tests.yml | 56 +++++++++++++++++++++++ core/src/main/resources/lib/c/reactor-c | 2 +- 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 .github/actions/setup-flexpret/action.yml create mode 100644 .github/workflows/c-flexpret-tests.yml diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml new file mode 100644 index 0000000000..9a2e718f8c --- /dev/null +++ b/.github/actions/setup-flexpret/action.yml @@ -0,0 +1,44 @@ +name: Install FlexPRET and dependencies (Linux only) +description: Install FlexPRET and dependencies (Linux only) +runs: + using: "composite" + steps: + - name: Setup + run: | + # Clone the FlexPRET repository + git clone --recurse-submodules https://github.com/pretis/flexpret + + # This rest is copied directly from FlexPRET's `azure-pipelines.yml` + + # Ubuntu 20.04 only has Verilator 4.028 but we neeed a more modern version + # so we do not use 'sudo apt-get install -y -qq verilator' here. + wget -q https://github.com/sifive/verilator/releases/download/4.036-0sifive2/verilator_4.036-0sifive2_amd64.deb -O verilator.deb + sudo dpkg -i verilator.deb + + # Install riscv compiler + wget -q https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.3/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -O riscv.tgz + tar zxf riscv.tgz + mv xpack-riscv-none-embed-gcc-8.3.0-2.3 ~/riscv-embed-gcc + ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-as ~/riscv-embed-gcc/bin/riscv32-unknown-elf-as + ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ar ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ar + ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-gcc ~/riscv-embed-gcc/bin/riscv32-unknown-elf-gcc + ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ld ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ld + ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objdump ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objdump + ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objcopy ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objcopy + + # Update submodules + git submodule update --init --recursive + shell: bash + - name: Build FlexPRET and install to SDK + run: | + # Step into cloned directory + cd flexpret + + # Source environment + source bash.env + + # Build FlexPRET's high memory configuration and install it to SDK + cd $FP_PATH && cmake -DFP_CONFIG=highmem -B build && cd build && make all install + + # No need to build the SDK itself because it is in interface library + shell: bash diff --git a/.github/workflows/c-flexpret-tests.yml b/.github/workflows/c-flexpret-tests.yml new file mode 100644 index 0000000000..95a1307365 --- /dev/null +++ b/.github/workflows/c-flexpret-tests.yml @@ -0,0 +1,56 @@ +name: C FlexPRET tests + +on: + workflow_call: + inputs: + compiler-ref: + required: false + type: string + runtime-ref: + required: false + type: string + use-cpp: + required: false + type: boolean + default: false + scheduler: + required: false + type: string + all-platforms: + required: false + default: true + type: boolean + +jobs: + flexpret-tests: + runs-on: ubuntu-latest + steps: + - name: Check out lingua-franca repository + uses: actions/checkout@v3 + with: + repository: lf-lang/lingua-franca + submodules: true + ref: ${{ inputs.compiler-ref }} + fetch-depth: 0 + - name: Prepare build environment + uses: ./.github/actions/prepare-build-env + - name: Setup and build FlexPRET + uses: ./.github/actions/setup-flexpret + - name: Check out specific ref of reactor-c + uses: actions/checkout@v3 + with: + repository: lf-lang/reactor-c + path: core/src/main/resources/lib/c/reactor-c + ref: ${{ inputs.runtime-ref }} + if: ${{ inputs.runtime-ref }} + - name: Run FlexPRET smoke tests + run: | + ./gradlew core:integrationTest \ + --tests org.lflang.tests.runtime.CFlexPRETTest.* \ + core:integrationTestCodeCoverageReport + rm -rf test/C/src-gen + - name: Report to CodeCov + uses: ./.github/actions/report-code-coverage + with: + files: core/build/reports/jcoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml + if: ${{ github.repository == 'lf-lang/lingua-franca' }} diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index bd54f002c3..e04610baf8 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit bd54f002c307c6dd230260e14370131f1a2dd45c +Subproject commit e04610baf8f7ffe861fe6131efcfec8045785c6c From 6eced85a15e82dc2bde262ce59a8ccfd74e367c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 4 May 2024 14:13:33 +0200 Subject: [PATCH 15/42] Bump reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index e04610baf8..0366a731cd 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit e04610baf8f7ffe861fe6131efcfec8045785c6c +Subproject commit 0366a731cdbd5bb3cdadbf8d031de4f89b756b70 From cdc07029a2722dd4e1bf28773c287237efcf9ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 4 May 2024 14:39:54 +0200 Subject: [PATCH 16/42] Fix issue reported by CI --- .../java/org/lflang/generator/c/CMainFunctionGenerator.java | 2 +- core/src/main/java/org/lflang/util/ArduinoUtil.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java b/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java index ba054d6e49..cf8c9cb1e9 100644 --- a/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java @@ -57,7 +57,7 @@ private String generateMainFunction() { "}\n", "// Arduino setup() and loop() functions", "void setup() {", - "\tSerial.begin(" + targetConfig.get(PlatformProperty.INSTANCE).baudRate() + ");", + "\tSerial.begin(" + targetConfig.get(PlatformProperty.INSTANCE).baudRate().value() + ");", "\tlf_register_print_function(&_lf_arduino_print_message_function, LOG_LEVEL);", "\tlf_reactor_c_main(0, NULL);", "}\n", diff --git a/core/src/main/java/org/lflang/util/ArduinoUtil.java b/core/src/main/java/org/lflang/util/ArduinoUtil.java index b811cc8d01..098e166e15 100644 --- a/core/src/main/java/org/lflang/util/ArduinoUtil.java +++ b/core/src/main/java/org/lflang/util/ArduinoUtil.java @@ -110,7 +110,7 @@ public void buildArduino(FileConfig fileConfig, TargetConfig targetConfig) { + fileConfig.name + " finished with no errors."); if (targetConfig.get(PlatformProperty.INSTANCE).flash().value()) { - if (targetConfig.get(PlatformProperty.INSTANCE).port() != null) { + if (targetConfig.get(PlatformProperty.INSTANCE).port().value() != null) { messageReporter.nowhere().info("Invoking flash command for Arduino"); LFCommand flash = commandFactory.createCommand( From 7f96f280d8cad574a70d38e0bf1beafd3a172056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 4 May 2024 14:55:08 +0200 Subject: [PATCH 17/42] Apply spotless --- .github/actions/setup-flexpret/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index 9a2e718f8c..9aa259cb72 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -14,7 +14,7 @@ runs: # so we do not use 'sudo apt-get install -y -qq verilator' here. wget -q https://github.com/sifive/verilator/releases/download/4.036-0sifive2/verilator_4.036-0sifive2_amd64.deb -O verilator.deb sudo dpkg -i verilator.deb - + # Install riscv compiler wget -q https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.3/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -O riscv.tgz tar zxf riscv.tgz From 5291921833d51f307826844c2f1567b4c15a5086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 4 May 2024 15:07:18 +0200 Subject: [PATCH 18/42] Another formatting. --- .../lflang/tests/runtime/CFlexPRETTest.java | 44 +++++++------- .../federated/extensions/CExtensionUtils.java | 2 +- .../lflang/generator/c/CCmakeGenerator.java | 17 +++--- .../org/lflang/generator/c/CCompiler.java | 2 +- .../org/lflang/generator/c/CGenerator.java | 23 +++---- .../generator/c/CMainFunctionGenerator.java | 4 +- .../target/property/PlatformProperty.java | 55 +++++++++-------- .../java/org/lflang/util/FlexPRETUtil.java | 60 ++++++++----------- .../java/org/lflang/tests/Configurators.java | 28 ++++----- 9 files changed, 112 insertions(+), 123 deletions(-) diff --git a/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java b/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java index eaacb29229..38a4e52cbb 100644 --- a/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java +++ b/core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java @@ -34,7 +34,7 @@ import org.lflang.tests.Transformers; public class CFlexPRETTest extends TestBase { - + public CFlexPRETTest() { super(Target.C); } @@ -43,38 +43,38 @@ public CFlexPRETTest() { public void buildFlexPRETConcurrent() { Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); super.runTestsFor( - List.of(Target.C), - "Build concurrent tests for FlexPRET.", - TestCategory.CONCURRENT::equals, - Transformers::noChanges, - Configurators::makeFlexPRETCompatible, - TestLevel.BUILD, - false); + List.of(Target.C), + "Build concurrent tests for FlexPRET.", + TestCategory.CONCURRENT::equals, + Transformers::noChanges, + Configurators::makeFlexPRETCompatible, + TestLevel.BUILD, + false); } @Test public void buildFlexPRETBasicTestsUnthreaded() { Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); super.runTestsFor( - List.of(Target.C), - "Build basic tests for FlexPRET in single threaded mode.", - TestCategory.BASIC::equals, - Transformers::noChanges, - Configurators::makeFlexPRETCompatibleUnthreaded, - TestLevel.BUILD, - false); + List.of(Target.C), + "Build basic tests for FlexPRET in single threaded mode.", + TestCategory.BASIC::equals, + Transformers::noChanges, + Configurators::makeFlexPRETCompatibleUnthreaded, + TestLevel.BUILD, + false); } @Test public void buildFlexPRETBasicTests() { Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); super.runTestsFor( - List.of(Target.C), - "Build basic tests for FlexPRET.", - TestCategory.BASIC::equals, - Transformers::noChanges, - Configurators::makeFlexPRETCompatible, - TestLevel.BUILD, - false); + List.of(Target.C), + "Build basic tests for FlexPRET.", + TestCategory.BASIC::equals, + Transformers::noChanges, + Configurators::makeFlexPRETCompatible, + TestLevel.BUILD, + false); } } diff --git a/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java b/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java index 01e3acb15c..2281c6a136 100644 --- a/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java +++ b/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java @@ -454,7 +454,7 @@ public static String surroundWithIfElseFederated(String insideIf, String insideE %s #else %s - #endif // FEDERATED + #endif // FEDERATED """ .formatted(insideIf, insideElse); } diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index d2f3446d54..4d911922c8 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -200,14 +200,10 @@ CodeBuilder generateCMakeCode( break; case FLEXPRET: if (System.getenv("FP_PATH") == null) { - messageReporter. - nowhere(). - warning("No FP_PATH environment variable found"); + messageReporter.nowhere().warning("No FP_PATH environment variable found"); } if (System.getenv("FP_SDK_PATH") == null) { - messageReporter. - nowhere(). - warning("No FP_SDK_PATH environment variable found"); + messageReporter.nowhere().warning("No FP_SDK_PATH environment variable found"); } cMakeCode.newLine(); cMakeCode.pr("# Include toolchain file and set project"); @@ -449,7 +445,8 @@ CodeBuilder generateCMakeCode( } if (platformOptions.platform() == Platform.FLEXPRET) { - cMakeCode.pr(""" + cMakeCode.pr( + """ # FlexPRET SDK generates a script that runs the program; # install it to the top-level bin install( @@ -457,9 +454,9 @@ CodeBuilder generateCMakeCode( DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS OWNER_EXECUTE # Need execute, the others are normal permissions - OWNER_READ - OWNER_WRITE - GROUP_READ + OWNER_READ + OWNER_WRITE + GROUP_READ WORLD_READ ) """); diff --git a/core/src/main/java/org/lflang/generator/c/CCompiler.java b/core/src/main/java/org/lflang/generator/c/CCompiler.java index 8a3c418849..cd1c663e22 100644 --- a/core/src/main/java/org/lflang/generator/c/CCompiler.java +++ b/core/src/main/java/org/lflang/generator/c/CCompiler.java @@ -41,8 +41,8 @@ import org.lflang.target.property.BuildTypeProperty; import org.lflang.target.property.CompilerProperty; import org.lflang.target.property.PlatformProperty; -import org.lflang.target.property.PlatformProperty.PlatformOptions; import org.lflang.target.property.PlatformProperty.Option; +import org.lflang.target.property.PlatformProperty.PlatformOptions; import org.lflang.target.property.TracePluginProperty; import org.lflang.target.property.type.BuildTypeType.BuildType; import org.lflang.target.property.type.PlatformType.Platform; diff --git a/core/src/main/java/org/lflang/generator/c/CGenerator.java b/core/src/main/java/org/lflang/generator/c/CGenerator.java index 158371bd9f..0d47f7db74 100644 --- a/core/src/main/java/org/lflang/generator/c/CGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CGenerator.java @@ -559,13 +559,12 @@ public void doGenerate(Resource resource, LFGeneratorContext context) { var platform = targetConfig.getOrDefault(PlatformProperty.INSTANCE); if (platform.flash().value()) { /** - * Flash will result in two widely different responses when board - * is set to `emulator` and `fpga`. For emulator, it will immediately - * run the emulator. For fpga, it will attempt to transfer the program - * to the fpga. - * - * It is FlexPRET's software development kit that handles all this; - * we just run the script it generates. + * Flash will result in two widely different responses when board is set to `emulator` + * and `fpga`. For emulator, it will immediately run the emulator. For fpga, it will + * attempt to transfer the program to the fpga. + * + *

It is FlexPRET's software development kit that handles all this; we just run the + * script it generates. */ FlexPRETUtil flexPRETUtil = new FlexPRETUtil(context, commandFactory, messageReporter); flexPRETUtil.flashTarget(fileConfig, targetConfig); @@ -656,8 +655,7 @@ private void generateCodeFor(String lfModuleName) throws IOException { "\n", "void logical_tag_complete(tag_t tag_to_send) {", CExtensionUtils.surroundWithIfElseFederatedCentralized( - " lf_latest_tag_complete(tag_to_send);", - " (void) tag_to_send;"), + " lf_latest_tag_complete(tag_to_send);", " (void) tag_to_send;"), "}")); // Generate an empty termination function for non-federated @@ -2003,7 +2001,8 @@ protected void setUpGeneralParameters() { final var platformOptions = targetConfig.get(PlatformProperty.INSTANCE); if (!targetConfig.get(SingleThreadedProperty.INSTANCE) && platformOptions.platform() == Platform.ARDUINO - && (!platformOptions.board().setByUser() || !platformOptions.board().value().contains("mbed"))) { + && (!platformOptions.board().setByUser() + || !platformOptions.board().value().contains("mbed"))) { // non-MBED boards should not use threading messageReporter .nowhere() @@ -2031,7 +2030,9 @@ protected void setUpGeneralParameters() { && platformOptions.userThreads().value() >= 0) { targetConfig .get(CompileDefinitionsProperty.INSTANCE) - .put(PlatformOption.USER_THREADS.name(), String.valueOf(platformOptions.userThreads().value())); + .put( + PlatformOption.USER_THREADS.name(), + String.valueOf(platformOptions.userThreads().value())); } pickCompilePlatform(); } diff --git a/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java b/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java index cf8c9cb1e9..bdb52f51ed 100644 --- a/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CMainFunctionGenerator.java @@ -57,7 +57,9 @@ private String generateMainFunction() { "}\n", "// Arduino setup() and loop() functions", "void setup() {", - "\tSerial.begin(" + targetConfig.get(PlatformProperty.INSTANCE).baudRate().value() + ");", + "\tSerial.begin(" + + targetConfig.get(PlatformProperty.INSTANCE).baudRate().value() + + ");", "\tlf_register_print_function(&_lf_arduino_print_message_function, LOG_LEVEL);", "\tlf_reactor_c_main(0, NULL);", "}\n", diff --git a/core/src/main/java/org/lflang/target/property/PlatformProperty.java b/core/src/main/java/org/lflang/target/property/PlatformProperty.java index 5991b6cce9..ec9d97e0d7 100644 --- a/core/src/main/java/org/lflang/target/property/PlatformProperty.java +++ b/core/src/main/java/org/lflang/target/property/PlatformProperty.java @@ -13,7 +13,6 @@ import org.lflang.target.property.type.DictionaryType.DictionaryElement; import org.lflang.target.property.type.PlatformType; import org.lflang.target.property.type.PlatformType.Platform; - import org.lflang.target.property.type.PrimitiveType; import org.lflang.target.property.type.TargetPropertyType; import org.lflang.target.property.type.UnionType; @@ -33,10 +32,10 @@ private PlatformProperty() { @Override public PlatformOptions initialValue() { - Option board = new Option(false, null); - Option port = new Option(false, null); - Option baudRate = new Option(false, 0); - Option flash = new Option(false, false); + Option board = new Option(false, null); + Option port = new Option(false, null); + Option baudRate = new Option(false, 0); + Option flash = new Option(false, false); Option userThreads = new Option(false, 0); return new PlatformOptions(Platform.AUTO, board, port, baudRate, flash, userThreads); @@ -51,10 +50,10 @@ public PlatformOptions fromAst(Element node, MessageReporter reporter) { String portValue = null; boolean portSet = false; - + int baudRateValue = 0; boolean baudRateSet = false; - + boolean flashValue = false; boolean flashSet = false; @@ -98,10 +97,10 @@ public PlatformOptions fromAst(Element node, MessageReporter reporter) { } } - Option board = new Option(boardSet, boardValue); - Option port = new Option(portSet, portValue); - Option baudRate = new Option(baudRateSet, baudRateValue); - Option flash = new Option(flashSet, flashValue); + Option board = new Option(boardSet, boardValue); + Option port = new Option(portSet, portValue); + Option baudRate = new Option(baudRateSet, baudRateValue); + Option flash = new Option(flashSet, flashValue); Option userThreads = new Option(userThreadsSet, userThreadsValue); return new PlatformOptions(platform, board, port, baudRate, flash, userThreads); @@ -134,8 +133,8 @@ 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."); + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .error("Platform " + Platform.RP2040 + " does not support threading."); } } @@ -145,27 +144,32 @@ private void validateFlexPRET(TargetConfig config, MessageReporter reporter) { if (board.setByUser()) { if (!board.value().equals("emulator") && !board.value().equals("fpga")) { reporter - .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) - .error("Only \"emulator\" and \"fpga\" are valid options for board property. Got " + board + "."); + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .error( + "Only \"emulator\" and \"fpga\" are valid options for board property. Got " + + board + + "."); } // Do validation specific to emulator if (board.value().equals("emulator")) { if (platform.port().setByUser()) { reporter - .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) - .warning("Port property ignored for emulator"); + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .warning("Port property ignored for emulator"); } if (platform.baudRate().setByUser()) { reporter - .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) - .warning("Baudrate property ignored for emulator"); + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .warning("Baudrate property ignored for emulator"); } } else { if (platform.baudRate().setByUser()) { reporter - .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) - .error("Baudrate property is entirely controlled by FlexPRET's SDK and cannot be set by the user"); + .at(config.lookup(this), Literals.KEY_VALUE_PAIR__VALUE) + .error( + "Baudrate property is entirely controlled by FlexPRET's SDK and cannot be set by" + + " the user"); } } } @@ -215,10 +219,7 @@ public String name() { return "platform"; } - /** - * Keep track of whether a value was set by user or not. - * - */ + /** Keep track of whether a value was set by user or not. */ public record Option(boolean setByUser, T value) {} /** Settings related to Platform Options. */ @@ -255,9 +256,7 @@ public record PlatformOptions( */ Option flash, - /** - * The number of threads requested by the user. - */ + /** The number of threads requested by the user. */ Option userThreads) { public String[] boardArray() { diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index 328d5b1271..de66a0bf14 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -2,20 +2,19 @@ import java.io.IOException; import java.util.Collections; - import org.eclipse.xtext.xbase.lib.Exceptions; import org.lflang.FileConfig; import org.lflang.MessageReporter; import org.lflang.generator.GeneratorCommandFactory; import org.lflang.generator.LFGeneratorContext; -import org.lflang.target.property.PlatformProperty; import org.lflang.target.TargetConfig; +import org.lflang.target.property.PlatformProperty; public class FlexPRETUtil { private LFGeneratorContext context; private GeneratorCommandFactory commandFactory; private MessageReporter messageReporter; - + public FlexPRETUtil( LFGeneratorContext context, GeneratorCommandFactory commandFactory, @@ -28,56 +27,47 @@ public FlexPRETUtil( public void flashTarget(FileConfig fileConfig, TargetConfig config) { var binPath = fileConfig.binPath; var exeName = fileConfig.name; - - /** - * FlexPRET's SDK generates a runnable bash script. We just need to run it. - */ + + /** FlexPRET's SDK generates a runnable bash script. We just need to run it. */ var cmd = binPath + "/" + exeName; - var args = Collections. emptyList(); - + var args = Collections.emptyList(); + try { LFCommand flash = commandFactory.createCommand(cmd, args); - + /** - * Check if environment variable FP_SDK_FPGA_INTERFACE_PROGRAM is set. - * If it is set, we should let the user know it is not supported by LF. - * - * We cannot support it because FP_SDK_FPGA_INTERFACE_PROGRAM will lead to - * a [Y/n] prompt, and the LFCommands do not have a way of getting the - * prompt response. - * - * When FP_SDK_FPGA_INTERFACE_PROGRAM is not set, there is no prompt. + * Check if environment variable FP_SDK_FPGA_INTERFACE_PROGRAM is set. If it is set, we should + * let the user know it is not supported by LF. + * + *

We cannot support it because FP_SDK_FPGA_INTERFACE_PROGRAM will lead to a [Y/n] prompt, + * and the LFCommands do not have a way of getting the prompt response. + * + *

When FP_SDK_FPGA_INTERFACE_PROGRAM is not set, there is no prompt. */ var envInterfaceProgram = System.getenv("FP_SDK_FPGA_INTERFACE_PROGRAM"); - + /** - * FP_SDK_FPGA_INTERFACE_PROGRAM is only relevant when the user has specified - * board = fpga and flash = true. So only print the info message if that - * is the case. + * FP_SDK_FPGA_INTERFACE_PROGRAM is only relevant when the user has specified board = fpga and + * flash = true. So only print the info message if that is the case. */ var platform = config.get(PlatformProperty.INSTANCE); - var interfaceProgramRelevant = platform.board().value().equals("fpga") - && platform.flash().value() == true; - + var interfaceProgramRelevant = + platform.board().value().equals("fpga") && platform.flash().value() == true; + if (interfaceProgramRelevant && envInterfaceProgram != null) { messageReporter - .nowhere() - .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); + .nowhere() + .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); } - /** - * Set the variable to nothing for the flash command, which will avoid the - * [Y/n] prompt - */ + /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); if (flash != null) { int ret = flash.run(context.getCancelIndicator()); if (ret != 0) { - messageReporter - .nowhere() - .error("Command " + cmd + " failed with exit code: " + ret); + messageReporter.nowhere().error("Command " + cmd + " failed with exit code: " + ret); throw new IOException("Could not flash"); - } + } } } catch (IOException e) { Exceptions.sneakyThrow(e); diff --git a/core/src/testFixtures/java/org/lflang/tests/Configurators.java b/core/src/testFixtures/java/org/lflang/tests/Configurators.java index cb48f55a8a..91522e57bd 100644 --- a/core/src/testFixtures/java/org/lflang/tests/Configurators.java +++ b/core/src/testFixtures/java/org/lflang/tests/Configurators.java @@ -27,8 +27,8 @@ import org.lflang.target.TargetConfig; import org.lflang.target.property.LoggingProperty; import org.lflang.target.property.PlatformProperty; -import org.lflang.target.property.PlatformProperty.PlatformOptions; import org.lflang.target.property.PlatformProperty.Option; +import org.lflang.target.property.PlatformProperty.PlatformOptions; import org.lflang.target.property.SingleThreadedProperty; import org.lflang.target.property.WorkersProperty; import org.lflang.target.property.type.LoggingType.LogLevel; @@ -107,23 +107,23 @@ public static boolean makeZephyrCompatible(TargetConfig config) { public static boolean makeFlexPRETCompatible(TargetConfig config) { /** - * FlexPRET has a maximum of eight hardware threads; override the chosen - * number of worker threads to be 0 (meaning run-time selects it). - * - * This is to avoid failing tests that have e.g., `workers: 16`. + * FlexPRET has a maximum of eight hardware threads; override the chosen number of worker + * threads to be 0 (meaning run-time selects it). + * + *

This is to avoid failing tests that have e.g., `workers: 16`. */ WorkersProperty.INSTANCE.override(config, 0); - + var platform = config.get(PlatformProperty.INSTANCE); PlatformProperty.INSTANCE.override( - config, - new PlatformOptions( - Platform.FLEXPRET, - new Option(true, "emulator"), - platform.port(), - platform.baudRate(), - new Option(true, false), - platform.userThreads())); + config, + new PlatformOptions( + Platform.FLEXPRET, + new Option(true, "emulator"), + platform.port(), + platform.baudRate(), + new Option(true, false), + platform.userThreads())); return true; } From 0823188a29869acd0ba8b6a12118a5b513e4007a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 4 May 2024 15:36:41 +0200 Subject: [PATCH 19/42] Bump reactor-c to solve Arduino CI issue --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 0366a731cd..4764f1fd7a 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 0366a731cdbd5bb3cdadbf8d031de4f89b756b70 +Subproject commit 4764f1fd7a4db6fa44fdf3bb26d6f2027209296c From b0fb028231805e0710ad6ca301f211fa455a809a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 5 May 2024 08:11:21 +0200 Subject: [PATCH 20/42] Bump reactor-c and fix bug in FlexPRET flash command --- core/src/main/java/org/lflang/util/FlexPRETUtil.java | 1 + core/src/main/resources/lib/c/reactor-c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index de66a0bf14..abbe57cf55 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -52,6 +52,7 @@ public void flashTarget(FileConfig fileConfig, TargetConfig config) { */ var platform = config.get(PlatformProperty.INSTANCE); var interfaceProgramRelevant = + platform.board().value() != null && platform.board().value().equals("fpga") && platform.flash().value() == true; if (interfaceProgramRelevant && envInterfaceProgram != null) { diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 4764f1fd7a..9c5baecb72 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 4764f1fd7a4db6fa44fdf3bb26d6f2027209296c +Subproject commit 9c5baecb72cbbfed00c534a8b746f68ff5f7d6b0 From 6f3c71fe4102815527488e58d4f2b77defdb9735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 5 May 2024 08:23:55 +0200 Subject: [PATCH 21/42] Fix format violations --- core/src/main/java/org/lflang/util/FlexPRETUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index abbe57cf55..8810dc9d7c 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -52,8 +52,9 @@ public void flashTarget(FileConfig fileConfig, TargetConfig config) { */ var platform = config.get(PlatformProperty.INSTANCE); var interfaceProgramRelevant = - platform.board().value() != null && - platform.board().value().equals("fpga") && platform.flash().value() == true; + platform.board().value() != null + && platform.board().value().equals("fpga") + && platform.flash().value() == true; if (interfaceProgramRelevant && envInterfaceProgram != null) { messageReporter From 3f4b96d2b91fa5cdc86a534770d7b80d170aed83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 5 May 2024 09:38:21 +0200 Subject: [PATCH 22/42] Add FlexPRET tests to CI --- .github/workflows/only-c.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/only-c.yml b/.github/workflows/only-c.yml index e49d0b2d81..f3f0fb33ef 100644 --- a/.github/workflows/only-c.yml +++ b/.github/workflows/only-c.yml @@ -35,6 +35,10 @@ jobs: zephyr: uses: ./.github/workflows/c-zephyr-tests.yml + # Run the C FlexPRET integration tests. + flexpret: + uses: ./.github/workflows/c-flexpret-tests.yml + # Run the CCpp integration tests. ccpp: uses: ./.github/workflows/c-tests.yml From 0c2c1ecc2d095dcd50b8b1e6b273bcef5f77dbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Fri, 10 May 2024 16:15:35 +0200 Subject: [PATCH 23/42] Fix minor bug with setting env variable --- core/src/main/java/org/lflang/util/FlexPRETUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index 8810dc9d7c..a936507e53 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -62,9 +62,10 @@ public void flashTarget(FileConfig fileConfig, TargetConfig config) { .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); } - /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ - flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); if (flash != null) { + /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ + flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); + int ret = flash.run(context.getCancelIndicator()); if (ret != 0) { messageReporter.nowhere().error("Command " + cmd + " failed with exit code: " + ret); From e718747fa4463f0ad78faaf13f4bcd4237174284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Fri, 10 May 2024 16:16:00 +0200 Subject: [PATCH 24/42] Attempt to resolve CI issues --- .github/workflows/c-embedded.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/only-c.yml | 16 +++------------- 2 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/c-embedded.yml diff --git a/.github/workflows/c-embedded.yml b/.github/workflows/c-embedded.yml new file mode 100644 index 0000000000..a86bf02f19 --- /dev/null +++ b/.github/workflows/c-embedded.yml @@ -0,0 +1,28 @@ +name: C embedded + +on: + workflow_dispatch: + workflow_call: + +env: + # 2020.11 + vcpkgGitRef: 0bf3923f9fab4001c00f0f429682a0853b5749e0 + +concurrency: + group: c-embedded-${{ github.ref }}-${{ github.event_path }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + # Run the C Arduino integration tests. + arduino: + uses: ./.github/workflows/c-arduino-tests.yml + with: + all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + + # Run the C Zephyr integration tests. + zephyr: + uses: ./.github/workflows/c-zephyr-tests.yml + + # Run the C FlexPRET integration tests. + flexpret: + uses: ./.github/workflows/c-flexpret-tests.yml diff --git a/.github/workflows/only-c.yml b/.github/workflows/only-c.yml index f3f0fb33ef..c162102d08 100644 --- a/.github/workflows/only-c.yml +++ b/.github/workflows/only-c.yml @@ -25,19 +25,9 @@ jobs: with: target: "C" - # Run the C Arduino integration tests. - arduino: - uses: ./.github/workflows/c-arduino-tests.yml - with: - all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} - - # Run the C Zephyr integration tests. - zephyr: - uses: ./.github/workflows/c-zephyr-tests.yml - - # Run the C FlexPRET integration tests. - flexpret: - uses: ./.github/workflows/c-flexpret-tests.yml + # Run C embedded tests + embedded: + uses: ./.github/workflows/c-embedded.yml # Run the CCpp integration tests. ccpp: From 439a4d73de9722ce55cbfb1701199a9caa885370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Fri, 10 May 2024 16:48:20 +0200 Subject: [PATCH 25/42] Apply formatter --- core/src/main/java/org/lflang/util/FlexPRETUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index a936507e53..90740f0c8d 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -65,7 +65,7 @@ public void flashTarget(FileConfig fileConfig, TargetConfig config) { if (flash != null) { /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); - + int ret = flash.run(context.getCancelIndicator()); if (ret != 0) { messageReporter.nowhere().error("Command " + cmd + " failed with exit code: " + ret); From f8965b5a039b06254aa6f48b3b37f0728d1bda42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Tue, 14 May 2024 16:00:46 +0200 Subject: [PATCH 26/42] Bump reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 9c5baecb72..d36cf28a90 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 9c5baecb72cbbfed00c534a8b746f68ff5f7d6b0 +Subproject commit d36cf28a90a861a5d8a0a9808e698ee927947287 From f4346f235db6a96e53e2fef96c7fff144a58308d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 21:51:34 +0200 Subject: [PATCH 27/42] Bump reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index b879063e7e..869d7865e5 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit b879063e7ec809ef0e0f64b37dd9064e48b4caa8 +Subproject commit 869d7865e50549aa312178d3cd0f0991b3f5b839 From 908383c00c6fdac2d578c1e5e251a7cee72ec420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:12:15 +0200 Subject: [PATCH 28/42] Add all-embedded.yml top-level workflow --- .github/workflows/all-embedded.yml | 33 ++++++++++++++++++++++++++++++ .github/workflows/only-c.yml | 4 ---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/all-embedded.yml diff --git a/.github/workflows/all-embedded.yml b/.github/workflows/all-embedded.yml new file mode 100644 index 0000000000..96d7fe4d50 --- /dev/null +++ b/.github/workflows/all-embedded.yml @@ -0,0 +1,33 @@ +# Tests for embedded platforms +name: CI (by embedded platforms) + +on: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '0 8 * * 6' + workflow_dispatch: + push: + branches: + - master + pull_request: + types: [synchronize, opened, reopened, ready_for_review, converted_to_draft] + merge_group: + +env: + # 2020.11 + vcpkgGitRef: 0bf3923f9fab4001c00f0f429682a0853b5749e0 + +concurrency: + group: all-embedded-${{ github.ref }}-${{ github.event_path }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + check-diff: + uses: ./.github/workflows/check-diff.yml + + c-embedded: + uses: ./.github/workflows/c-embedded.yml + needs: check-diff + if: ${{ needs.check-diff.outputs.run_c == 'true' }} + + # Add more languages if supported diff --git a/.github/workflows/only-c.yml b/.github/workflows/only-c.yml index c162102d08..32d539fb49 100644 --- a/.github/workflows/only-c.yml +++ b/.github/workflows/only-c.yml @@ -25,10 +25,6 @@ jobs: with: target: "C" - # Run C embedded tests - embedded: - uses: ./.github/workflows/c-embedded.yml - # Run the CCpp integration tests. ccpp: uses: ./.github/workflows/c-tests.yml From b4bf936cf11621b22f6ba5263cfb2e211aa7cfca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:14:59 +0200 Subject: [PATCH 29/42] Update setup-flexpret/action.yml --- .github/actions/setup-flexpret/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index 9aa259cb72..53284e613a 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -39,6 +39,4 @@ runs: # Build FlexPRET's high memory configuration and install it to SDK cd $FP_PATH && cmake -DFP_CONFIG=highmem -B build && cd build && make all install - - # No need to build the SDK itself because it is in interface library - shell: bash + shell: bash From 31019be091f4220e7f55d40c4b7d23d190370de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:19:01 +0200 Subject: [PATCH 30/42] Update setup-flexpret/action.yml --- .github/actions/setup-flexpret/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index 53284e613a..1f51a20bb6 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -35,7 +35,7 @@ runs: cd flexpret # Source environment - source bash.env + source env.bash # Build FlexPRET's high memory configuration and install it to SDK cd $FP_PATH && cmake -DFP_CONFIG=highmem -B build && cd build && make all install From 1b800197db35716ff55f41c881453b511fd3b30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:25:57 +0200 Subject: [PATCH 31/42] Update setup-flexpret/action.yml --- .github/workflows/c-flexpret-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/c-flexpret-tests.yml b/.github/workflows/c-flexpret-tests.yml index 95a1307365..7b01eb9e45 100644 --- a/.github/workflows/c-flexpret-tests.yml +++ b/.github/workflows/c-flexpret-tests.yml @@ -45,6 +45,7 @@ jobs: if: ${{ inputs.runtime-ref }} - name: Run FlexPRET smoke tests run: | + cd $FP_PATH && source env.bash ./gradlew core:integrationTest \ --tests org.lflang.tests.runtime.CFlexPRETTest.* \ core:integrationTestCodeCoverageReport From 5a72997b0d6da176bcbb54e16170847687a6ff5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:35:09 +0200 Subject: [PATCH 32/42] Update c-flexpret-tests.yml --- .github/workflows/c-flexpret-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-flexpret-tests.yml b/.github/workflows/c-flexpret-tests.yml index 7b01eb9e45..747f6e6ba4 100644 --- a/.github/workflows/c-flexpret-tests.yml +++ b/.github/workflows/c-flexpret-tests.yml @@ -45,7 +45,7 @@ jobs: if: ${{ inputs.runtime-ref }} - name: Run FlexPRET smoke tests run: | - cd $FP_PATH && source env.bash + cd && cd flexpret && source env.bash && cd ./gradlew core:integrationTest \ --tests org.lflang.tests.runtime.CFlexPRETTest.* \ core:integrationTestCodeCoverageReport From 51407095c9f774adfedbf203b60e32ace8c10f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:39:57 +0200 Subject: [PATCH 33/42] Update CI --- .github/actions/setup-flexpret/action.yml | 3 +++ .github/workflows/c-flexpret-tests.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index 1f51a20bb6..f9f445fe53 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -34,6 +34,9 @@ runs: # Step into cloned directory cd flexpret + # Save pwd to environment variable so we can find `env.bash` in later steps + echo "FP_DIR=$(pwd)" >> "$GITHUB_ENV" + # Source environment source env.bash diff --git a/.github/workflows/c-flexpret-tests.yml b/.github/workflows/c-flexpret-tests.yml index 747f6e6ba4..10ed39f000 100644 --- a/.github/workflows/c-flexpret-tests.yml +++ b/.github/workflows/c-flexpret-tests.yml @@ -45,7 +45,7 @@ jobs: if: ${{ inputs.runtime-ref }} - name: Run FlexPRET smoke tests run: | - cd && cd flexpret && source env.bash && cd + cd "$FP_DIR" && source env.bash && cd - ./gradlew core:integrationTest \ --tests org.lflang.tests.runtime.CFlexPRETTest.* \ core:integrationTestCodeCoverageReport From ba1f764d52eaf88430cf3c75cd41e9ec04048f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 22:49:19 +0200 Subject: [PATCH 34/42] Update CI --- .github/actions/setup-flexpret/action.yml | 3 +++ .github/workflows/c-flexpret-tests.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index f9f445fe53..33c38ab8c8 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -28,6 +28,9 @@ runs: # Update submodules git submodule update --init --recursive + + # Save location of RISC-V compiler to reuse later + echo "FP_RISCV_COMPILER=~/riscv-embed-gcc" >> "$GITHUB_ENV" shell: bash - name: Build FlexPRET and install to SDK run: | diff --git a/.github/workflows/c-flexpret-tests.yml b/.github/workflows/c-flexpret-tests.yml index 10ed39f000..fa0759ef56 100644 --- a/.github/workflows/c-flexpret-tests.yml +++ b/.github/workflows/c-flexpret-tests.yml @@ -46,6 +46,7 @@ jobs: - name: Run FlexPRET smoke tests run: | cd "$FP_DIR" && source env.bash && cd - + export RISCV_TOOL_PATH_PREFIX=$FP_RISCV_COMPILER ./gradlew core:integrationTest \ --tests org.lflang.tests.runtime.CFlexPRETTest.* \ core:integrationTestCodeCoverageReport From 980f30e0a723caebb826ab41022bae07bcc25a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sat, 18 May 2024 23:36:44 +0200 Subject: [PATCH 35/42] Formatting --- .github/workflows/all-embedded.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all-embedded.yml b/.github/workflows/all-embedded.yml index 96d7fe4d50..2b05637545 100644 --- a/.github/workflows/all-embedded.yml +++ b/.github/workflows/all-embedded.yml @@ -12,7 +12,7 @@ on: pull_request: types: [synchronize, opened, reopened, ready_for_review, converted_to_draft] merge_group: - + env: # 2020.11 vcpkgGitRef: 0bf3923f9fab4001c00f0f429682a0853b5749e0 @@ -29,5 +29,5 @@ jobs: uses: ./.github/workflows/c-embedded.yml needs: check-diff if: ${{ needs.check-diff.outputs.run_c == 'true' }} - + # Add more languages if supported From 4a8c7e014ccd46659b3bbe264b02ffd25c542b01 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sat, 18 May 2024 21:59:12 -0700 Subject: [PATCH 36/42] Apply suggestions from code review --- .github/workflows/all-embedded.yml | 2 +- .github/workflows/c-flexpret-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all-embedded.yml b/.github/workflows/all-embedded.yml index 2b05637545..94c1d4dd74 100644 --- a/.github/workflows/all-embedded.yml +++ b/.github/workflows/all-embedded.yml @@ -1,5 +1,5 @@ # Tests for embedded platforms -name: CI (by embedded platforms) +name: CI (embedded platforms) on: schedule: diff --git a/.github/workflows/c-flexpret-tests.yml b/.github/workflows/c-flexpret-tests.yml index fa0759ef56..0df6abe62f 100644 --- a/.github/workflows/c-flexpret-tests.yml +++ b/.github/workflows/c-flexpret-tests.yml @@ -54,5 +54,5 @@ jobs: - name: Report to CodeCov uses: ./.github/actions/report-code-coverage with: - files: core/build/reports/jcoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml + files: core/build/reports/jacoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml if: ${{ github.repository == 'lf-lang/lingua-franca' }} From 2c5a4950d43800a88314b73cf40b3f76da70aecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 19 May 2024 16:13:56 +0200 Subject: [PATCH 37/42] Change install of riscv compiler for CI --- .github/actions/setup-flexpret/action.yml | 25 ++++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index 33c38ab8c8..5f61480b57 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -16,21 +16,26 @@ runs: sudo dpkg -i verilator.deb # Install riscv compiler - wget -q https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.3/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -O riscv.tgz - tar zxf riscv.tgz - mv xpack-riscv-none-embed-gcc-8.3.0-2.3 ~/riscv-embed-gcc - ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-as ~/riscv-embed-gcc/bin/riscv32-unknown-elf-as - ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ar ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ar - ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-gcc ~/riscv-embed-gcc/bin/riscv32-unknown-elf-gcc - ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ld ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ld - ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objdump ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objdump - ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objcopy ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objcopy + #wget -q https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.3/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -O riscv.tgz + #tar zxf riscv.tgz + #mv xpack-riscv-none-embed-gcc-8.3.0-2.3 ~/riscv-embed-gcc + #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-as ~/riscv-embed-gcc/bin/riscv32-unknown-elf-as + #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ar ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ar + #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-gcc ~/riscv-embed-gcc/bin/riscv32-unknown-elf-gcc + #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ld ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ld + #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objdump ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objdump + #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objcopy ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objcopy + + wget https://github.com/stnolting/riscv-gcc-prebuilt/releases/download/rv32i-4.0.0/riscv32-unknown-elf.gcc-12.1.0.tar.gz + sudo mkdir /opt/riscv + sudo tar -xzf riscv32-unknown-elf.gcc-12.1.0.tar.gz -C /opt/riscv/ + rm riscv32-unknown-elf.gcc-12.1.0.tar.gz # Update submodules git submodule update --init --recursive # Save location of RISC-V compiler to reuse later - echo "FP_RISCV_COMPILER=~/riscv-embed-gcc" >> "$GITHUB_ENV" + echo "FP_RISCV_COMPILER=/opt/riscv" >> "$GITHUB_ENV" shell: bash - name: Build FlexPRET and install to SDK run: | From c956598a9b44baee47e6a16ffecc85f7ff7e6f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Sun, 19 May 2024 16:35:11 +0200 Subject: [PATCH 38/42] Remove redundant code --- .github/actions/setup-flexpret/action.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/actions/setup-flexpret/action.yml b/.github/actions/setup-flexpret/action.yml index 5f61480b57..9866c15c6b 100644 --- a/.github/actions/setup-flexpret/action.yml +++ b/.github/actions/setup-flexpret/action.yml @@ -16,16 +16,6 @@ runs: sudo dpkg -i verilator.deb # Install riscv compiler - #wget -q https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.3/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -O riscv.tgz - #tar zxf riscv.tgz - #mv xpack-riscv-none-embed-gcc-8.3.0-2.3 ~/riscv-embed-gcc - #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-as ~/riscv-embed-gcc/bin/riscv32-unknown-elf-as - #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ar ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ar - #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-gcc ~/riscv-embed-gcc/bin/riscv32-unknown-elf-gcc - #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-ld ~/riscv-embed-gcc/bin/riscv32-unknown-elf-ld - #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objdump ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objdump - #ln -s ~/riscv-embed-gcc/bin/riscv-none-embed-objcopy ~/riscv-embed-gcc/bin/riscv32-unknown-elf-objcopy - wget https://github.com/stnolting/riscv-gcc-prebuilt/releases/download/rv32i-4.0.0/riscv32-unknown-elf.gcc-12.1.0.tar.gz sudo mkdir /opt/riscv sudo tar -xzf riscv32-unknown-elf.gcc-12.1.0.tar.gz -C /opt/riscv/ From 1c8c1dc9342964ca87ebaa1aaff631c8184b6aa5 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 20 May 2024 21:55:54 -0700 Subject: [PATCH 39/42] Apply suggestions from code review --- .github/workflows/all-embedded.yml | 3 --- .github/workflows/c-embedded.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/all-embedded.yml b/.github/workflows/all-embedded.yml index 94c1d4dd74..4776a1e530 100644 --- a/.github/workflows/all-embedded.yml +++ b/.github/workflows/all-embedded.yml @@ -2,9 +2,6 @@ name: CI (embedded platforms) on: - schedule: - # * is a special character in YAML so you have to quote this string - - cron: '0 8 * * 6' workflow_dispatch: push: branches: diff --git a/.github/workflows/c-embedded.yml b/.github/workflows/c-embedded.yml index a86bf02f19..f36bf3c73b 100644 --- a/.github/workflows/c-embedded.yml +++ b/.github/workflows/c-embedded.yml @@ -4,9 +4,6 @@ on: workflow_dispatch: workflow_call: -env: - # 2020.11 - vcpkgGitRef: 0bf3923f9fab4001c00f0f429682a0853b5749e0 concurrency: group: c-embedded-${{ github.ref }}-${{ github.event_path }} From 59545e4af34731f1c8d9ec5b7ac3eb701132171c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Tue, 21 May 2024 12:21:16 +0200 Subject: [PATCH 40/42] Remove unecessary exceptions in FlexPRETUtil.java --- .../java/org/lflang/util/FlexPRETUtil.java | 74 +++++++++---------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index 90740f0c8d..a75da193a0 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -1,8 +1,6 @@ package org.lflang.util; -import java.io.IOException; import java.util.Collections; -import org.eclipse.xtext.xbase.lib.Exceptions; import org.lflang.FileConfig; import org.lflang.MessageReporter; import org.lflang.generator.GeneratorCommandFactory; @@ -32,50 +30,46 @@ public void flashTarget(FileConfig fileConfig, TargetConfig config) { var cmd = binPath + "/" + exeName; var args = Collections.emptyList(); - try { - LFCommand flash = commandFactory.createCommand(cmd, args); + LFCommand flash = commandFactory.createCommand(cmd, args); - /** - * Check if environment variable FP_SDK_FPGA_INTERFACE_PROGRAM is set. If it is set, we should - * let the user know it is not supported by LF. - * - *

We cannot support it because FP_SDK_FPGA_INTERFACE_PROGRAM will lead to a [Y/n] prompt, - * and the LFCommands do not have a way of getting the prompt response. - * - *

When FP_SDK_FPGA_INTERFACE_PROGRAM is not set, there is no prompt. - */ - var envInterfaceProgram = System.getenv("FP_SDK_FPGA_INTERFACE_PROGRAM"); + /** + * Check if environment variable FP_SDK_FPGA_INTERFACE_PROGRAM is set. If it is set, we should + * let the user know it is not supported by LF. + * + *

We cannot support it because FP_SDK_FPGA_INTERFACE_PROGRAM will lead to a [Y/n] prompt, + * and the LFCommands do not have a way of getting the prompt response. + * + *

When FP_SDK_FPGA_INTERFACE_PROGRAM is not set, there is no prompt. + */ + var envInterfaceProgram = System.getenv("FP_SDK_FPGA_INTERFACE_PROGRAM"); - /** - * FP_SDK_FPGA_INTERFACE_PROGRAM is only relevant when the user has specified board = fpga and - * flash = true. So only print the info message if that is the case. - */ - var platform = config.get(PlatformProperty.INSTANCE); - var interfaceProgramRelevant = - platform.board().value() != null - && platform.board().value().equals("fpga") - && platform.flash().value() == true; + /** + * FP_SDK_FPGA_INTERFACE_PROGRAM is only relevant when the user has specified board = fpga and + * flash = true. So only print the info message if that is the case. + */ + var platform = config.get(PlatformProperty.INSTANCE); + var interfaceProgramRelevant = + platform.board().value() != null + && platform.board().value().equals("fpga") + && platform.flash().value() == true; - if (interfaceProgramRelevant && envInterfaceProgram != null) { - messageReporter - .nowhere() - .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); - } + if (interfaceProgramRelevant && envInterfaceProgram != null) { + messageReporter + .nowhere() + .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); + } - if (flash != null) { - /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ - flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); + if (flash != null) { + /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ + flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); - int ret = flash.run(context.getCancelIndicator()); - if (ret != 0) { - messageReporter.nowhere().error("Command " + cmd + " failed with exit code: " + ret); - throw new IOException("Could not flash"); - } + int ret = flash.run(context.getCancelIndicator()); + if (ret != 0) { + messageReporter + .nowhere() + .error( + "Command " + cmd + " failed with exit code: " + ret + ". Is the target connected?"); } - } catch (IOException e) { - Exceptions.sneakyThrow(e); - } catch (NullPointerException e) { - Exceptions.sneakyThrow(e); } } } From 55972052d020f3747c4e9616cfb2c792e4c5d922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20M=C3=A6hlum?= Date: Wed, 22 May 2024 00:05:30 +0200 Subject: [PATCH 41/42] Remove use of FP_SDK_FPGA_INTERFACE_PROGRAM --- .../java/org/lflang/util/FlexPRETUtil.java | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/core/src/main/java/org/lflang/util/FlexPRETUtil.java b/core/src/main/java/org/lflang/util/FlexPRETUtil.java index a75da193a0..bf565bf915 100644 --- a/core/src/main/java/org/lflang/util/FlexPRETUtil.java +++ b/core/src/main/java/org/lflang/util/FlexPRETUtil.java @@ -6,7 +6,6 @@ import org.lflang.generator.GeneratorCommandFactory; import org.lflang.generator.LFGeneratorContext; import org.lflang.target.TargetConfig; -import org.lflang.target.property.PlatformProperty; public class FlexPRETUtil { private LFGeneratorContext context; @@ -32,37 +31,7 @@ public void flashTarget(FileConfig fileConfig, TargetConfig config) { LFCommand flash = commandFactory.createCommand(cmd, args); - /** - * Check if environment variable FP_SDK_FPGA_INTERFACE_PROGRAM is set. If it is set, we should - * let the user know it is not supported by LF. - * - *

We cannot support it because FP_SDK_FPGA_INTERFACE_PROGRAM will lead to a [Y/n] prompt, - * and the LFCommands do not have a way of getting the prompt response. - * - *

When FP_SDK_FPGA_INTERFACE_PROGRAM is not set, there is no prompt. - */ - var envInterfaceProgram = System.getenv("FP_SDK_FPGA_INTERFACE_PROGRAM"); - - /** - * FP_SDK_FPGA_INTERFACE_PROGRAM is only relevant when the user has specified board = fpga and - * flash = true. So only print the info message if that is the case. - */ - var platform = config.get(PlatformProperty.INSTANCE); - var interfaceProgramRelevant = - platform.board().value() != null - && platform.board().value().equals("fpga") - && platform.flash().value() == true; - - if (interfaceProgramRelevant && envInterfaceProgram != null) { - messageReporter - .nowhere() - .info("FP_SDK_FPGA_INTERFACE_PROGRAM not supported by LF. It will have no effect."); - } - if (flash != null) { - /** Set the variable to nothing for the flash command, which will avoid the [Y/n] prompt */ - flash.setEnvironmentVariable("FP_SDK_FPGA_INTERFACE_PROGRAM", ""); - int ret = flash.run(context.getCancelIndicator()); if (ret != 0) { messageReporter From 228d5b1352759f6c7ec172fd1b3e00f1548a7801 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Wed, 22 May 2024 17:24:33 +0200 Subject: [PATCH 42/42] Bump reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 869d7865e5..c7583dcd64 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 869d7865e50549aa312178d3cd0f0991b3f5b839 +Subproject commit c7583dcd64f0726fea898b118cb00e853251de42