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

Fix relative paths to custom upload method file, fix incorrect CAN length on STMicro #380

Merged
merged 2 commits into from
Nov 15, 2024
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
4 changes: 2 additions & 2 deletions targets/TARGET_STM/can_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ int can_write(can_t *obj, CAN_Message msg, int cc)
int can_read(can_t *obj, CAN_Message *msg, int handle)
{
//FIFO selection cannot be controlled by software for STM32, default FIFO is 0, hence handle is not used
int rxfifo_default = DEFAULT_RXFIFO;
const int rxfifo_default = DEFAULT_RXFIFO;
CAN_TypeDef *can = obj->CanHandle.Instance;

// check FPM0 which holds the pending message count in FIFO 0
Expand All @@ -1033,7 +1033,7 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)

msg->type = (CANType)(((uint8_t)0x02 & can->sFIFOMailBox[rxfifo_default].RIR) >> 1);
/* Get the DLC */
msg->len = ((uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR < 8) ? ((uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR) : ((uint8_t) 8);
msg->len = ((can->sFIFOMailBox[rxfifo_default].RDTR & CAN_RDT0R_DLC) < 8) ? (CAN_RDT0R_DLC & can->sFIFOMailBox[rxfifo_default].RDTR) : ((uint8_t) 8);
/* Get the FMI */
// msg->FMI = (uint8_t)0xFF & (can->sFIFOMailBox[rxfifo_default].RDTR >> 8);
/* Get the data field */
Expand Down
2 changes: 2 additions & 0 deletions tools/cmake/app.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ set(EXPECTED_MBED_UPLOAD_CFG_FILE_PATH ${MBED_SOURCE_DIR}/targets/upload_method_

# check if a custom upload config path is defined in top lvl cmake
if((DEFINED CUSTOM_UPLOAD_CFG_PATH))
# Make path absolute, as required by EXISTS
get_filename_component(CUSTOM_UPLOAD_CFG_PATH "${CUSTOM_UPLOAD_CFG_PATH}" ABSOLUTE BASE_DIR ${CMAKE_SOURCE_DIR})
if(EXISTS ${CUSTOM_UPLOAD_CFG_PATH})
include(${CUSTOM_UPLOAD_CFG_PATH})
message(STATUS "Mbed: Custom upload config included from ${CUSTOM_UPLOAD_CFG_PATH}")
Expand Down