-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] Bugs Found while building FSW25 Demo #236
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,4 +79,4 @@ main reactor | |
ping.finished -> pong.finish; | ||
ping.send -> pong.receive; | ||
pong.send -> ping.receive; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,15 +61,16 @@ function(lf_build_generated_code MAIN_TARGET SOURCE_GEN_DIR) | |
endif() | ||
|
||
# Check if the Include.cmake file exists in SOURCE_GEN_DIR | ||
if (NOT EXISTS ${SOURCE_GEN_DIR}/Include.cmake) | ||
if (NOT EXISTS ${SOURCE_GEN_DIR}/${FEDERATE}/Include.cmake) | ||
message(FATAL_ERROR "Include.cmake does not exist in src-gen directory: ${SOURCE_GEN_DIR}/Include.cmake") | ||
endif() | ||
|
||
include(${SOURCE_GEN_DIR}/Include.cmake) | ||
include(${SOURCE_GEN_DIR}/${FEDERATE}/Include.cmake) | ||
message(${REACTOR_UC_PATH}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, dont think we should introduce the dependency on this global variable. ALso no need to print the REACTOR_UC_PATH here |
||
add_subdirectory(${REACTOR_UC_PATH}) | ||
target_sources(${MAIN_TARGET} PRIVATE ${LFC_GEN_MAIN} ${LFC_GEN_SOURCES}) | ||
target_include_directories(${MAIN_TARGET} PRIVATE ${LFC_GEN_INCLUDE_DIRS}) | ||
target_link_libraries(${MAIN_TARGET} PUBLIC reactor-uc) | ||
target_compile_definitions(reactor-uc PUBLIC LF_LOG_LEVEL_ALL=${LOG_LEVEL}) | ||
target_compile_definitions(reactor-uc PUBLIC ${LFC_GEN_COMPILE_DEFS}) | ||
endfunction() | ||
endfunction() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,7 @@ struct PolledNetworkChannel { | |
/** | ||
* @brief Polls for new data and calls the callback handler if a message is successfully decoded | ||
*/ | ||
void (*poll)(NetworkChannel *self); | ||
void (*poll)(PolledNetworkChannel *self); | ||
}; | ||
|
||
struct AsyncNetworkChannel { | ||
|
@@ -150,8 +150,11 @@ struct AsyncNetworkChannel { | |
#endif | ||
|
||
#elif defined(PLATFORM_PICO) | ||
#ifdef NETWORK_CHANNEL_TCP_POSIX | ||
#error "NETWORK_POSIX_TCP not supported on PICO" | ||
//#ifdef NETWORK_CHANNEL_TCP_POSIX | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this commented out? |
||
//#error "NETWORK_POSIX_TCP not supported on PICO" | ||
//#endif | ||
#ifdef NETWORK_CHANNEL_UART | ||
#include "platform/pico/uart_channel.h" | ||
#endif | ||
|
||
#elif defined(PLATFORM_FLEXPRET) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef REACTOR_UC_PICO_UART_CHANNEL_H | ||
#define REACTOR_UC_PICO_UART_CHANNEL_H | ||
|
||
#include "reactor-uc/network_channel/uart_channel.h" | ||
#include "reactor-uc/network_channel.h" | ||
#include "reactor-uc/environment.h" | ||
|
||
#include "pico/stdlib.h" | ||
#include "hardware/uart.h" | ||
#include "hardware/irq.h" | ||
|
||
typedef struct FederatedConnectionBundle FederatedConnectionBundle; | ||
typedef struct UartPolledChannel UartPolledChannel; | ||
typedef struct UartAsyncChannel UartAsyncChannel; | ||
|
||
#define UART_CHANNEL_BUFFERSIZE 1024 | ||
|
||
struct UartPolledChannel { | ||
PolledNetworkChannel super; | ||
NetworkChannelState state; | ||
FederateMessage output; | ||
unsigned char receive_buffer[UART_CHANNEL_BUFFERSIZE]; | ||
unsigned char send_buffer[UART_CHANNEL_BUFFERSIZE]; | ||
unsigned int receive_buffer_index; | ||
uart_inst_t *uart_device; | ||
|
||
FederatedConnectionBundle *bundle; | ||
void (*receive_callback)(FederatedConnectionBundle *bundle, const FederateMessage *message); | ||
}; | ||
|
||
void UartPolledChannel_ctor(UartPolledChannel *self, uint32_t uart_device, uint32_t baud, UartDataBits data_bits, | ||
UartParityBits parity, UartStopBits stop_bits); | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,8 @@ abstract class UcCmakeGenerator( | |
|set(LF_MAIN_TARGET ${mainTarget}) | ||
|set(CMAKE_BUILD_TYPE ${targetConfig.getOrDefault(BuildTypeProperty.INSTANCE)}) | ||
|set(PLATFORM POSIX CACHE STRING "Target platform") | ||
|include($S{CMAKE_CURRENT_SOURCE_DIR}/Include.cmake) | ||
|#include($S{CMAKE_CURRENT_SOURCE_DIR}/src-gen/$S{LF_MAIN}/$S{FEDERATE}/Include.cmake) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldnt code-generated commented out code. And this code change includes the same file but makes it more brittle by depending on a relative path |
||
|include(./Include.cmake) | ||
|add_executable($S{LF_MAIN_TARGET} $S{LFC_GEN_SOURCES} $S{LFC_GEN_MAIN}) | ||
|install(TARGETS $S{LF_MAIN_TARGET} | ||
| RUNTIME DESTINATION $S{CMAKE_INSTALL_BINDIR} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,12 @@ | |
#endif | ||
|
||
#elif defined(PLATFORM_PICO) | ||
#ifdef NETWORK_CHANNEL_TCP_POSIX | ||
#error "NETWORK_POSIC_TCP not supported on PICO" | ||
#endif | ||
//#ifdef NETWORK_CHANNEL_TCP_POSIX | ||
//#error "NETWORK_POSIC_TCP not supported on PICO" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this removed? |
||
//#endif | ||
// #ifdef NETWORK_CHANNEL_UART | ||
#include "platform/pico/uart_channel.c" | ||
// #endif | ||
|
||
#elif defined(PLATFORM_FLEXPRET) | ||
#ifdef NETWORK_CHANNEL_TCP_POSIX | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ void Platform_vprintf(const char *fmt, va_list args) { vprintf(fmt, args); } | |
|
||
lf_ret_t PlatformPico_initialize(Platform *self) { | ||
PlatformPico *p = (PlatformPico *)self; | ||
stdio_init_all(); | ||
//stdio_init_all(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why no stdio? |
||
// init sync structs | ||
critical_section_init(&p->crit_sec); | ||
sem_init(&p->sem, 0, 1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of introducing a global variable, the caller of lf_build_generated_code should pass the correct SOURCE_GEN_DIR to this function. If you code-generate a federated program, source-gen dir must include the federate name