Skip to content
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

Rework WP_App Interface #1814

Merged
merged 2 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CLR/Messaging/Messaging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ bool CLR_Messaging::ProcessPayload(WP_Message *msg)
}

// wrapper function for CLR_Messaging::ProcessPayload(
extern "C" int CLR_Messaging_ProcessPayload(WP_Message *msg)
extern "C" int Messaging_ProcessPayload(WP_Message *msg)
{
if (g_CLR_DBG_Debugger == NULL)
{
Expand Down
29 changes: 11 additions & 18 deletions src/CLR/WireProtocol/WireProtocol_App_Interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,21 @@
#include <nanoWeak.h>
#include "WireProtocol_App_Interface.h"

////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
// The functions below are the ones that need to be ported to client applications,
// tipically nanoBooter and CLR debugger
//
//
/////////////////////////////////////////////////////////////////////////////////////////////////
extern int Messaging_ProcessPayload(WP_Message *message);

// provided as weak to be replaced by actual implementation in the client application
__nfweak int WP_App_ProcessHeader(WP_Message* message)
int WP_App_ProcessHeader(WP_Message *message)
{
(void)(message);
// check for reception buffer overflow
if (message->m_header.m_size > sizeof(receptionBuffer))
{
return false;
}

// default to false
return false;
message->m_payload = receptionBuffer;
return true;
}

// provided as weak to be replaced by actual implementation in the client application
__nfweak int WP_App_ProcessPayload(WP_Message* message)
int WP_App_ProcessPayload(WP_Message *message)
{
(void)(message);

// default to false
return false;
return Messaging_ProcessPayload(message);
}
14 changes: 1 addition & 13 deletions targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_App_Interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,7 @@ static const CommandHandlerLookup c_Lookup_Reply[] = {
/*******************************************************************************************************************************************************************/
};

int WP_App_ProcessHeader(WP_Message *message)
{
// check for reception buffer overflow
if (message->m_header.m_size > sizeof(receptionBuffer))
{
return false;
}

message->m_payload = receptionBuffer;
return true;
}

int WP_App_ProcessPayload(WP_Message *message)
int Messaging_ProcessPayload(WP_Message *message)
{
// Prevent processing duplicate packets
if (message->m_header.m_seq == lastPacketSequence)
Expand Down
1 change: 0 additions & 1 deletion targets/CMSIS-OS/ChibiOS/nanoCLR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/target_platform.h.in
list(APPEND TARGET_CHIBIOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/targetHAL.cpp)

# append target ChibiOS nanoCLR source files
list(APPEND TARGET_CHIBIOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_App_Interface.c)
list(APPEND TARGET_CHIBIOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_MonitorCommands.c)
list(APPEND TARGET_CHIBIOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CLR_Startup_Thread.c)
list(APPEND TARGET_CHIBIOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/targetPAL.c)
Expand Down
30 changes: 0 additions & 30 deletions targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_App_Interface.c

This file was deleted.

14 changes: 1 addition & 13 deletions targets/FreeRTOS/NXP/nanoBooter/WireProtocol_App_Interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,7 @@ static const CommandHandlerLookup c_Lookup_Reply[] = {
/*******************************************************************************************************************************************************************/
};

int WP_App_ProcessHeader(WP_Message *message)
{
// check for reception buffer overflow
if (message->m_header.m_size > sizeof(receptionBuffer))
{
return false;
}

message->m_payload = receptionBuffer;
return true;
}

int WP_App_ProcessPayload(WP_Message *message)
int Messaging_ProcessPayload(WP_Message *message)
{
// Prevent processing duplicate packets
if (message->m_header.m_seq == lastPacketSequence)
Expand Down
1 change: 0 additions & 1 deletion targets/FreeRTOS/common/nanoCLR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set(TARGET_FREERTOS_NANOCLR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTER

# append nanoCLR source files
list(APPEND TARGET_FREERTOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CLR_Startup_Thread.c)
list(APPEND TARGET_FREERTOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_App_Interface.c)

# append target PAL source files
list(APPEND TARGET_FREERTOS_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/targetPAL_Events.cpp)
Expand Down
30 changes: 0 additions & 30 deletions targets/FreeRTOS/common/nanoCLR/WireProtocol_App_Interface.c

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/target_platform.h.in

# append target Esp32 nanoCLR source files
list(APPEND TARGET_ESP32_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/app_main.c)
list(APPEND TARGET_ESP32_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_App_Interface.c)
list(APPEND TARGET_ESP32_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_MonitorCommands.c)
list(APPEND TARGET_ESP32_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CLR_Startup_Thread.c)
list(APPEND TARGET_ESP32_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/targetPAL.c)
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion targets/TI-SimpleLink/nanoCLR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/target_platform.h.in
list(APPEND TARGET_TI_SimpleLink_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/targetHAL.cpp)

# append target nanoCLR source files
list(APPEND TARGET_TI_SimpleLink_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_App_Interface.c)
list(APPEND TARGET_TI_SimpleLink_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WireProtocol_MonitorCommands.c)
list(APPEND TARGET_TI_SimpleLink_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CLR_Startup_Thread.c)
list(APPEND TARGET_TI_SimpleLink_NANOCLR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/targetPAL.c)
Expand Down
30 changes: 0 additions & 30 deletions targets/TI-SimpleLink/nanoCLR/WireProtocol_App_Interface.c

This file was deleted.