Skip to content

Commit d46739b

Browse files
author
Jamie Smith
authored
Fix relative paths to custom upload method file, fix incorrect CAN length on STMicro (#380)
* Fix relative paths to custom upload method file, fix incorrect CAN length on STMicro * Wait we can do this better
1 parent 0a36502 commit d46739b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

targets/TARGET_STM/can_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ int can_write(can_t *obj, CAN_Message msg, int cc)
10141014
int can_read(can_t *obj, CAN_Message *msg, int handle)
10151015
{
10161016
//FIFO selection cannot be controlled by software for STM32, default FIFO is 0, hence handle is not used
1017-
int rxfifo_default = DEFAULT_RXFIFO;
1017+
const int rxfifo_default = DEFAULT_RXFIFO;
10181018
CAN_TypeDef *can = obj->CanHandle.Instance;
10191019

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

10341034
msg->type = (CANType)(((uint8_t)0x02 & can->sFIFOMailBox[rxfifo_default].RIR) >> 1);
10351035
/* Get the DLC */
1036-
msg->len = ((uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR < 8) ? ((uint8_t)0x0F & can->sFIFOMailBox[rxfifo_default].RDTR) : ((uint8_t) 8);
1036+
msg->len = ((can->sFIFOMailBox[rxfifo_default].RDTR & CAN_RDT0R_DLC) < 8) ? (CAN_RDT0R_DLC & can->sFIFOMailBox[rxfifo_default].RDTR) : ((uint8_t) 8);
10371037
/* Get the FMI */
10381038
// msg->FMI = (uint8_t)0xFF & (can->sFIFOMailBox[rxfifo_default].RDTR >> 8);
10391039
/* Get the data field */

tools/cmake/app.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ set(EXPECTED_MBED_UPLOAD_CFG_FILE_PATH ${MBED_SOURCE_DIR}/targets/upload_method_
6464

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

0 commit comments

Comments
 (0)