Skip to content

Commit

Permalink
fix portenta build, added core-m85.cmake/mk
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Dec 13, 2024
1 parent ad0ac67 commit f3a304e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 16 deletions.
25 changes: 25 additions & 0 deletions examples/build_system/cmake/cpu/cortex-m85.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m85
-mfloat-abi=hard
-mfpu=fpv5-d16
)
set(FREERTOS_PORT GCC_ARM_CM85_NTZ_NONSECURE CACHE INTERNAL "")

elseif (TOOLCHAIN STREQUAL "clang")
set(TOOLCHAIN_COMMON_FLAGS
--target=arm-none-eabi
-mcpu=cortex-m85
-mfpu=fpv5-d16
)
set(FREERTOS_PORT GCC_ARM_CM85_NTZ_NONSECURE CACHE INTERNAL "")

elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m85
--fpu VFPv5_D16
)
set(FREERTOS_PORT IAR_ARM_CM85_NTZ_NONSECURE CACHE INTERNAL "")

endif ()
27 changes: 27 additions & 0 deletions examples/build_system/make/cpu/cortex-m85.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m85 \
-mfloat-abi=hard \
-mfpu=fpv5-d16 \

else ifeq ($(TOOLCHAIN),clang)
CFLAGS += \
--target=arm-none-eabi \
-mcpu=cortex-m85 \
-mfpu=fpv5-d16 \

else ifeq ($(TOOLCHAIN),iar)
CFLAGS += \
--cpu cortex-m85 \
--fpu VFPv5_D16 \

ASFLAGS += \
--cpu cortex-m85 \
--fpu VFPv5_D16 \

else
$(error "TOOLCHAIN is not supported")
endif

FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM85_NTZ/non_secure
21 changes: 6 additions & 15 deletions hw/bsp/ra/boards/portenta_c33/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@ set(MCU_VARIANT ra6m5)
set(JLINK_DEVICE R7FA6M5BH)
set(DFU_UTIL_VID_PID 2341:0368)

set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/${BOARD}.ld)

# Device port default to PORT1 Highspeed
if (NOT DEFINED PORT)
set(PORT 1)
# device default to PORT 1 High Speed
if (NOT DEFINED RHPORT_DEVICE)
set(RHPORT_DEVICE 1)
endif()
if (NOT DEFINED RHPORT_HOST)
set(RHPORT_HOST 0)
endif()

# Host port will be the other port
set(HOST_PORT $<NOT:${PORT}>)

function(update_board TARGET)
target_compile_definitions(${TARGET} PUBLIC
BOARD_TUD_RHPORT=${PORT}
BOARD_TUH_RHPORT=${HOST_PORT}
# port 0 is fullspeed, port 1 is highspeed
BOARD_TUD_MAX_SPEED=$<IF:${PORT},OPT_MODE_HIGH_SPEED,OPT_MODE_FULL_SPEED>
BOARD_TUH_MAX_SPEED=$<IF:${HOST_PORT},OPT_MODE_HIGH_SPEED,OPT_MODE_FULL_SPEED>
)
endfunction()
3 changes: 2 additions & 1 deletion hw/bsp/ra/boards/portenta_c33/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ CPU_CORE = cortex-m33
MCU_VARIANT = ra6m5

# Port 1 is highspeed
PORT ?= 1
RHPORT_DEVICE ?= 1
RHPORT_HOST ?= 0

JLINK_DEVICE = R7FA6M5BH
DFU_UTIL_OPTION = -d 2341:0368 -a 0
Expand Down

0 comments on commit f3a304e

Please sign in to comment.