Skip to content

mpu stack guard: fix stack alignement #500

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
43c0aa9
boards: 96b_nitrogen: Add support for flash/debug with pyOCD
galak Jun 13, 2017
8ad631a
scripts: bossa-flash.sh: fix variable usage
galak Jun 13, 2017
6c79278
scripts: pyocd.sh: Add support for passing board_id to pyocd commands
galak Jun 15, 2017
9f9f210
board: frdm_k64f: allow overriding default debug/flash scripts
galak Jun 15, 2017
7a78fe8
boards: sam_e70_xplained: allow flashing via JTAG header
mnkp Jun 14, 2017
fb10290
arm: soc: stm32: make mpu f4 config useable for other family
jamike Jun 9, 2017
01c0d83
arm: soc: stm32: l4: add MPU capability for series
jamike Jun 9, 2017
d8111b3
boards: nucleo_l476rg: enable MPU
jamike Jun 9, 2017
4316839
boards: disco_l475_iot1: enable MPU
jamike Jun 9, 2017
eae347e
arm: soc: stm32: f3: add MPU capability
jamike Jun 16, 2017
e59a33d
arm: stm32f1: Add support for STM32F103x8 SoC
sidcha May 21, 2017
ca448bd
boards: arm: Add support for STM32 Minimum Development Board
sidcha May 21, 2017
ffe9dc3
dts: Rename k64f-uart to kinetis-uart
MaureenHelm Jun 20, 2017
51f9307
dts: Rename kw41z-lpuart to kinetis-lpuart
MaureenHelm Jun 20, 2017
3443430
dts: Rename k64f-pinmux to kinetis-pinmux
MaureenHelm Jun 20, 2017
120d53e
dts: Rename k64f-gpio to kinetis-gpio
MaureenHelm Jun 20, 2017
29b86da
dts: Rename k64sim to nxp,k64f-sim
MaureenHelm Jun 20, 2017
1e7388f
doc: fix doc errors in stm32_min_dev.rst (take 2)
dbkinder Jun 23, 2017
c1fed51
dts: disco_l475_iot1: add flash partition
jamike Jun 23, 2017
480cd47
boards; cc2650_sensortag: Get building with sanitycheck
galak Jun 23, 2017
c4c11de
dts: nucleo_f401re: add partition support for bootloader
jamike Jun 20, 2017
e81d29c
arm: mpu: fix: align stack for mpu stack guard
jamike Jun 27, 2017
95c6e6a
mpu_stack_guard_test: use thread macro to define stack
jamike Jun 27, 2017
f2d2305
mpu_stack_guard_test: add more thread for test
jamike Jun 27, 2017
1a620de
mpu_stack_guard_test: update log in README.rst
jamike Jun 27, 2017
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 arch/arm/core/cortex_m/mpu/arm_core_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void configure_mpu_stack_guard(struct k_thread *thread)
{
arm_core_mpu_disable();
arm_core_mpu_configure(THREAD_STACK_GUARD_REGION,
thread->stack_info.start,
thread->stack_info.start - STACK_ALIGN,
thread->stack_info.size);
arm_core_mpu_enable();
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/core/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void _new_thread(struct k_thread *thread, char *pStackMem, size_t stackSize,

char *stackEnd = pStackMem + stackSize;
struct __esf *pInitCtx;

_new_thread_init(thread, pStackMem, stackSize, priority, options);
_new_thread_init(thread, K_THREAD_STACK_BUFFER(pStackMem), stackSize,
priority, options);

/* carve the thread entry struct from the "base" of the stack */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/cortex_m/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern "C" {

#else

extern char _interrupt_stack[CONFIG_ISR_STACK_SIZE];
extern K_THREAD_STACK_DEFINE(_interrupt_stack, CONFIG_ISR_STACK_SIZE);

/**
*
Expand Down
1 change: 1 addition & 0 deletions arch/arm/soc/st_stm32/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

obj-y += $(SOC_SERIES)/
obj-y += common/
8 changes: 8 additions & 0 deletions arch/arm/soc/st_stm32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ config SOC_FAMILY
default st_stm32
endif

config STM32_ARM_MPU_ENABLE
bool "Enable MPU"
depends on CPU_HAS_MPU
select ARM_MPU
default n
help
Enable MPU

source "arch/arm/soc/st_stm32/*/Kconfig.soc"
1 change: 1 addition & 0 deletions arch/arm/soc/st_stm32/common/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-$(CONFIG_STM32_ARM_MPU_ENABLE) += arm_mpu_regions.o
19 changes: 0 additions & 19 deletions arch/arm/soc/st_stm32/stm32f1/Kconfig.defconfig.stm32f103xb

This file was deleted.

19 changes: 0 additions & 19 deletions arch/arm/soc/st_stm32/stm32f1/Kconfig.defconfig.stm32f103xe

This file was deleted.

31 changes: 31 additions & 0 deletions arch/arm/soc/st_stm32/stm32f1/Kconfig.defconfig.stm32f103xx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Kconfig - ST Microelectronics STM32F103XX MCU
#
# Copyright (c) 2017, embedjournal.com
#
# SPDX-License-Identifier: Apache-2.0
#

if SOC_STM32F103XB || SOC_STM32F103X8

config SOC
string
default stm32f103xb

config NUM_IRQS
int
default 59

endif # SOC_STM32F103XB || SOC_STM32F103X8

if SOC_STM32F103XE

config SOC
string
default stm32f103xe

config NUM_IRQS
int
default 68

endif # SOC_STM32F103XE

4 changes: 4 additions & 0 deletions arch/arm/soc/st_stm32/stm32f1/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ config SOC_STM32F103XB
bool "STM32F103XB"
select SOC_STM32F10X_DENSITY_DEVICE

config SOC_STM32F103X8
bool "STM32F103X8"
select SOC_STM32F10X_DENSITY_DEVICE

config SOC_STM32F107XC
bool "STM32F107XC"
select SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/soc/st_stm32/stm32f3/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ depends on SOC_SERIES_STM32F3X

config SOC_STM32F303XC
bool "STM32F303XC"
select CPU_HAS_MPU

config SOC_STM32F334X8
bool "STM32F334X8"

config SOC_STM32F373XC
bool "STM32F373XC"
select CPU_HAS_MPU

endchoice
7 changes: 0 additions & 7 deletions arch/arm/soc/st_stm32/stm32f4/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ config SOC_STM32F469XI

endchoice

config STM32_ARM_MPU_ENABLE
bool "Enable MPU"
depends on CPU_HAS_MPU
select ARM_MPU
default n
help
Enable MPU

choice
prompt "Configure Bootloader Options"
Expand Down
1 change: 0 additions & 1 deletion arch/arm/soc/st_stm32/stm32f4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ obj-y += soc.o

obj-$(CONFIG_GPIO) += soc_gpio.o
obj-$(CONFIG_PINMUX) += soc_pinmux.o
obj-$(CONFIG_STM32_ARM_MPU_ENABLE) += arm_mpu_regions.o

zephyr: $(KERNEL_HEX_NAME)
all: $(KERNEL_HEX_NAME)
1 change: 1 addition & 0 deletions arch/arm/soc/st_stm32/stm32l4/Kconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config SOC_SERIES_STM32L4X
select CPU_CORTEX_M4
select SOC_FAMILY_STM32
select SYS_POWER_LOW_POWER_STATE_SUPPORTED
select CPU_HAS_MPU
select CPU_HAS_SYSTICK
select CLOCK_CONTROL_STM32_CUBE if CLOCK_CONTROL
help
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/soc/ti_simplelink/cc2650/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ ti_ccfg[CCFG_SIZE / sizeof(u32_t)] = {
static const u32_t clkloadctl =
REG_ADDR(TI_CC2650_PRCM_40082000_BASE_ADDRESS,
CC2650_PRCM_CLKLOADCTL);
#ifdef CONFIG_CC2650_TRNG_RANDOM_GENERATOR
static const u32_t secdmaclkgr =
REG_ADDR(TI_CC2650_PRCM_40082000_BASE_ADDRESS,
CC2650_PRCM_SECDMACLKGR);
#endif
static const u32_t gpioclkgr =
REG_ADDR(TI_CC2650_PRCM_40082000_BASE_ADDRESS,
CC2650_PRCM_GPIOCLKGR);
Expand All @@ -78,9 +80,11 @@ static const u32_t pdctl0 =
static const u32_t pdstat0 =
REG_ADDR(TI_CC2650_PRCM_40082000_BASE_ADDRESS,
CC2650_PRCM_PDSTAT0);
#ifdef CONFIG_SERIAL
static const u32_t uartclkgr =
REG_ADDR(TI_CC2650_PRCM_40082000_BASE_ADDRESS,
CC2650_PRCM_UARTCLKGR);
#endif

/* Setup power and clock for needed hardware modules. */
static void setup_modules_prcm(void)
Expand Down
6 changes: 6 additions & 0 deletions boards/arm/96b_nitrogen/Makefile.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FLASH_SCRIPT = pyocd.sh
DEBUG_SCRIPT = pyocd.sh

PYOCD_TARGET = nrf52

export FLASH_SCRIPT PYOCD_TARGET
19 changes: 11 additions & 8 deletions boards/arm/96b_nitrogen/doc/96b_nitrogen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,22 +267,25 @@ and install a more recent version of pyOCD.
Flashing an Application to 96Boards Nitrogen
============================================

The sample application :ref:`hello_world` is being used in this tutorial:
This example uses the :ref:`hello_world` sample with the
:ref:`nxp_opensda_pyocd` tools. Use the ``make flash`` build target to build
your Zephyr application, invoke the pyOCD flash tool and program your Zephyr
application to flash.

.. code-block:: console

$<zephyr_root_path>/samples/hello_world
$ cd <zephyr_root_path>
$ . zephyr-env.sh
$ cd samples/hello_world/
$ make BOARD=96b_nitrogen

To build the Zephyr kernel and application, enter:
You can either flash the board by using the `make flash` target:

.. code-block:: console

$ cd <zephyr_root_path>
$ source zephyr-env.sh
$ cd $ZEPHYR_BASE/samples/hello_world/
$ make BOARD=96b_nitrogen
$ make flash

Connect the micro-USB cable to the 96Boards Nitrogen and to your computer.
or you can invoke the pyocd commands directly, as described below.

Erase the flash memory in the nRF52832:

Expand Down
8 changes: 8 additions & 0 deletions boards/arm/cc2650_sensortag/cc2650_sensortag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
identifier: cc2650_sensortag
name: SimpleLink multi-standard CC2650 SensorTag kit
type: mcu
arch: arm
toolchain:
- zephyr
- gccarmemb
ram: 20
3 changes: 3 additions & 0 deletions boards/arm/disco_l475_iot1/disco_l475_iot1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_1"
CONFIG_PWM=y
CONFIG_PWM_STM32=y

#enable MPU
CONFIG_STM32_ARM_MPU_ENABLE=y

#enable I2C
CONFIG_I2C=y
CONFIG_I2C_STM32LX=y
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/frdm_k64f/Makefile.board
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FLASH_SCRIPT = pyocd.sh
DEBUG_SCRIPT = pyocd.sh
FLASH_SCRIPT ?= pyocd.sh
DEBUG_SCRIPT ?= pyocd.sh

OPENOCD_LOAD_CMD = "flash write_image erase ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"
OPENOCD_VERIFY_CMD = "verify_image ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"
Expand Down
3 changes: 3 additions & 0 deletions boards/arm/nucleo_l476rg/nucleo_l476rg_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_2"
CONFIG_PWM=y
CONFIG_PWM_STM32=y
CONFIG_PWM_STM32_2=y
#enable MPU
CONFIG_STM32_ARM_MPU_ENABLE=y

10 changes: 10 additions & 0 deletions boards/arm/sam_e70_xplained/doc/sam_e70_xplained.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ Flashing
The command will also verify that the image was programmed correctly, reset
the board and run the Zephyr application.

You can flash the image using an external debug adapter such as J-Link or
ULINK, connected to the 20-pin JTAG header. Supply the name of the debug
adapter (e.g., `jlink`) to the make command via an OPENOCD_INTERFACE
variable. OpenOCD will look for the appropriate interface configuration in an
`interface/$(OPENOCD_INTERFACE).cfg` file on its internal search path.

.. code-block:: console

$ make BOARD=sam_e70_xplained OPENOCD_INTERFACE=jlink flash

You should see "Hello World!" in your terminal.

Debugging
Expand Down
27 changes: 21 additions & 6 deletions boards/arm/sam_e70_xplained/support/openocd.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
source [find board/atmel_same70_xplained.cfg]
if {[info exists env(OPENOCD_INTERFACE)]} {
set INTERFACE $env(OPENOCD_INTERFACE)
} else {
# By default connect over Debug USB port using the EDBG chip
set INTERFACE "cmsis-dap"
}

source [find interface/$INTERFACE.cfg]

transport select swd

set CHIPNAME atsame70q21

source [find target/atsamv.cfg]

reset_config srst_only

$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}

$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
echo "Debugger detaching: resuming execution"
resume
}
9 changes: 9 additions & 0 deletions boards/arm/stm32_min_dev/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Kconfig - STM32 Minimum Development Board Configuration
#
# Copyright (c) 2017, embedjournal.com
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_STM32_MIN_DEV
bool "STM32 Minimum Development Board"
depends on SOC_STM32F103X8
13 changes: 13 additions & 0 deletions boards/arm/stm32_min_dev/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Kconfig - STM32 Minimum Development Board Configuration
#
# Copyright (c) 2017, embedjournal.com
#
# SPDX-License-Identifier: Apache-2.0
#

if BOARD_STM32_MIN_DEV

config BOARD
default stm32_min_dev

endif # BOARD_STM32_MIN_DEV
2 changes: 2 additions & 0 deletions boards/arm/stm32_min_dev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# No C files (yet)
obj- += dummy.o
7 changes: 7 additions & 0 deletions boards/arm/stm32_min_dev/Makefile.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FLASH_SCRIPT = openocd.sh
DEBUG_SCRIPT = openocd.sh

OPENOCD_LOAD_CMD = "flash write_image erase ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"
OPENOCD_VERIFY_CMD = "verify_image ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}"

export FLASH_SCRIPT OPENOCD_LOAD_CMD OPENOCD_VERIFY_CMD
16 changes: 16 additions & 0 deletions boards/arm/stm32_min_dev/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2017, embedjournal.com
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __INC_BOARD_H
#define __INC_BOARD_H

#include <soc.h>

/* On board LED */
#define LED0_GPIO_PORT "GPIOB"
#define LED0_GPIO_PIN 12

#endif /* __INC_BOARD_H */
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading