mirror of https://github.com/rusefi/ChibiOS.git
Fixed bug #1027.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12752 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
739aa3f70c
commit
5b0dfd658f
|
@ -116,6 +116,19 @@ void PendSV_Handler(void) {
|
|||
/* Module exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || \
|
||||
(PORT_ENABLE_GUARD_PAGES == TRUE) || \
|
||||
defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Setting up MPU region for the current thread.
|
||||
*/
|
||||
void _port_set_region(void) {
|
||||
|
||||
mpuSetRegionAddress(PORT_USE_MPU_REGION,
|
||||
chThdGetSelfX()->wabase);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Exception exit redirection to _port_switch_from_isr().
|
||||
*/
|
||||
|
|
|
@ -81,6 +81,13 @@
|
|||
#define PORT_ENABLE_GUARD_PAGES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief MPU region to be used to stack guards.
|
||||
*/
|
||||
#if !defined(PORT_USE_MPU_REGION) || defined(__DOXYGEN__)
|
||||
#define PORT_USE_MPU_REGION MPU_REGION_7
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Stack size for the system idle thread.
|
||||
* @details This size depends on the idle thread implementation, usually
|
||||
|
@ -478,12 +485,8 @@ struct port_intctx {
|
|||
_port_switch(ntp, otp); \
|
||||
\
|
||||
/* Setting up the guard page for the switched-in thread.*/ \
|
||||
mpuConfigureRegion(MPU_REGION_0, \
|
||||
chThdGetSelfX()->wabase, \
|
||||
MPU_RASR_ATTR_AP_NA_NA | \
|
||||
MPU_RASR_ATTR_NON_CACHEABLE | \
|
||||
MPU_RASR_SIZE_32 | \
|
||||
MPU_RASR_ENABLE); \
|
||||
mpuSetRegionAddress(PORT_USE_MPU_REGION, \
|
||||
chThdGetSelfX()->wabase); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -535,7 +538,7 @@ static inline void port_init(void) {
|
|||
|
||||
/* Setting up the guard page on the main() function stack base
|
||||
initially.*/
|
||||
mpuConfigureRegion(MPU_REGION_0,
|
||||
mpuConfigureRegion(PORT_USE_MPU_REGION,
|
||||
&__main_thread_stack_base__,
|
||||
MPU_RASR_ATTR_AP_NA_NA |
|
||||
MPU_RASR_ATTR_NON_CACHEABLE |
|
||||
|
|
|
@ -103,6 +103,9 @@ _port_switch:
|
|||
.thumb_func
|
||||
.globl _port_thread_start
|
||||
_port_thread_start:
|
||||
#if CH_DBG_ENABLE_STACK_CHECK || PORT_ENABLE_GUARD_PAGES
|
||||
bl _port_set_region
|
||||
#endif
|
||||
#if CH_DBG_SYSTEM_STATE_CHECK
|
||||
bl _dbg_check_unlock
|
||||
#endif
|
||||
|
|
|
@ -62,8 +62,10 @@ ICSR_PENDSVSET SET 0x10000000
|
|||
SECTION .text:CODE:NOROOT(2)
|
||||
|
||||
EXTERN chThdExit
|
||||
EXTERN chSysHalt
|
||||
EXTERN chSchDoReschedule
|
||||
#if CH_DBG_ENABLE_STACK_CHECK || PORT_ENABLE_GUARD_PAGES
|
||||
EXTERN _port_set_region
|
||||
#endif
|
||||
#if CH_DBG_STATISTICS
|
||||
EXTERN _stats_start_measure_crit_thd
|
||||
EXTERN _stats_stop_measure_crit_thd
|
||||
|
@ -107,6 +109,9 @@ _port_switch:
|
|||
*/
|
||||
PUBLIC _port_thread_start
|
||||
_port_thread_start:
|
||||
#if CH_DBG_ENABLE_STACK_CHECK || PORT_ENABLE_GUARD_PAGES
|
||||
bl _port_set_region
|
||||
#endif
|
||||
#if CH_DBG_SYSTEM_STATE_CHECK
|
||||
bl _dbg_check_unlock
|
||||
#endif
|
||||
|
|
|
@ -60,6 +60,9 @@ ICSR_PENDSVSET EQU 0x10000000
|
|||
|
||||
IMPORT chThdExit
|
||||
IMPORT chSchDoReschedule
|
||||
#if CH_DBG_ENABLE_STACK_CHECK || PORT_ENABLE_GUARD_PAGES
|
||||
IMPORT _port_set_region
|
||||
#endif
|
||||
#if CH_DBG_STATISTICS
|
||||
IMPORT _stats_start_measure_crit_thd
|
||||
IMPORT _stats_stop_measure_crit_thd
|
||||
|
@ -102,6 +105,9 @@ _port_switch PROC
|
|||
*/
|
||||
EXPORT _port_thread_start
|
||||
_port_thread_start PROC
|
||||
#if CH_DBG_ENABLE_STACK_CHECK || PORT_ENABLE_GUARD_PAGES
|
||||
bl _port_set_region
|
||||
#endif
|
||||
#if CH_DBG_SYSTEM_STATE_CHECK
|
||||
bl _dbg_check_unlock
|
||||
#endif
|
||||
|
|
|
@ -196,6 +196,20 @@
|
|||
MPU->RASR = ((uint32_t)attribs); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Changes an MPU region base address.
|
||||
*
|
||||
* @param[in] region the region number
|
||||
* @param[in] address start address of the region, note, there are alignment
|
||||
* constraints
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define mpuSetRegionAddress(region, addr) { \
|
||||
MPU->RNR = ((uint32_t)region); \
|
||||
MPU->RBAR = ((uint32_t)addr); \
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -196,6 +196,20 @@
|
|||
MPU->RASR = ((uint32_t)attribs); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Changes an MPU region base address.
|
||||
*
|
||||
* @param[in] region the region number
|
||||
* @param[in] address start address of the region, note, there are alignment
|
||||
* constraints
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define mpuSetRegionAddress(region, addr) { \
|
||||
MPU->RNR = ((uint32_t)region); \
|
||||
MPU->RBAR = ((uint32_t)addr); \
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
- HAL: Added a new interface for range-finder devices (used by EX).
|
||||
- HAL: Added mcuconf.h updater tool for STM32F407 (backported to 19.1.1).
|
||||
- NIL: Integrated NIL 4.0.
|
||||
- FIX: Fixed MPU setup missing on thread start (bug #1027)
|
||||
(backported to 19.1.2)(backported to 18.2.3).
|
||||
- FIX: Fixed invalid I2C4 DMAs for STM32F76x (bug #1026)
|
||||
(backported to 19.1.2)(backported to 18.2.3).
|
||||
- FIX: Fixed invalid STM32_UART7_RX_DMA_CHN for STM32F469 (bug #1025)
|
||||
|
|
Loading…
Reference in New Issue