diff --git a/boards/nxp/fmurt1062-v1/nuttx-config/Kconfig b/boards/nxp/fmurt1062-v1/nuttx-config/Kconfig index 433c13fcad..40f0d9dd0a 100644 --- a/boards/nxp/fmurt1062-v1/nuttx-config/Kconfig +++ b/boards/nxp/fmurt1062-v1/nuttx-config/Kconfig @@ -20,7 +20,7 @@ config BOARD_HAS_PROBES default y ---help--- This board provides GPIO FMU-CH1-8, as PROBE_1-8 to provide timing signals - from selected drivers. + from selected drivers. config BOARD_USE_PROBES bool "Enable the use the board provided FMU-CH1-8 as PROBE_1-8" @@ -29,4 +29,13 @@ config BOARD_USE_PROBES ---help--- Select to use GPIO FMU-CH1-8, as PROBE_1-8 to provide timing signals - from selected drivers. + from selected drivers. + +config BOARD_FORCE_ALIGNMENT + bool "Forces all acesses to be Aligned" + default n + + ---help--- + Adds -mno-unaligned-access to build flags. to force alignment. + This can be needed if data is stored in a region of memory, that + is Strongly ordered and dcache is off. diff --git a/platforms/nuttx/NuttX/Make.defs.in b/platforms/nuttx/NuttX/Make.defs.in index 5299325b46..3833f53e51 100644 --- a/platforms/nuttx/NuttX/Make.defs.in +++ b/platforms/nuttx/NuttX/Make.defs.in @@ -116,6 +116,11 @@ FLAGS = $(MAXOPTIMIZATION) -g2 \ FLAGS += $(EXTRAFLAGS) +# force alignment +ifeq ($(CONFIG_BOARD_FORCE_ALIGNMENT),y) + FLAGS += -mno-unaligned-access +endif + # enable precise stack overflow tracking ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) FLAGS += -finstrument-functions -ffixed-r10 diff --git a/platforms/nuttx/cmake/px4_impl_os.cmake b/platforms/nuttx/cmake/px4_impl_os.cmake index e5a04a3cfc..5e92bf0a9f 100644 --- a/platforms/nuttx/cmake/px4_impl_os.cmake +++ b/platforms/nuttx/cmake/px4_impl_os.cmake @@ -86,6 +86,13 @@ function(px4_os_add_flags) ) endif() + if("${CONFIG_BOARD_FORCE_ALIGNMENT}" STREQUAL "y") + message(STATUS "Board forcing alignment") + add_compile_options( + -mno-unaligned-access + ) + endif() + endfunction() #=============================================================================