mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
arch/arm/src/stm32l4/stm32l4_firewall.c: Correct a test to determine if an address lies in FLASH or not. Improper mask caused test to always fail.
This commit is contained in:
@@ -68,6 +68,7 @@
|
|||||||
/* 0x00100000-0x07ffffff: Reserved */
|
/* 0x00100000-0x07ffffff: Reserved */
|
||||||
#define STM32L4_FLASH_BASE 0x08000000 /* 0x08000000-0x080fffff: FLASH memory */
|
#define STM32L4_FLASH_BASE 0x08000000 /* 0x08000000-0x080fffff: FLASH memory */
|
||||||
/* 0x08100000-0x0fffffff: Reserved */
|
/* 0x08100000-0x0fffffff: Reserved */
|
||||||
|
#define STM32L4_FLASH_MASK 0xf8000000 /* Test if addr in FLASH */
|
||||||
#define STM32L4_SRAM2_BASE 0x10000000 /* 0x10000000-0x1000ffff: 16k to 64k SRAM2 */
|
#define STM32L4_SRAM2_BASE 0x10000000 /* 0x10000000-0x1000ffff: 16k to 64k SRAM2 */
|
||||||
/* 0x10010000-0x1ffeffff: Reserved */
|
/* 0x10010000-0x1ffeffff: Reserved */
|
||||||
#define STM32L4_SRAM3_BASE 0x20040000 /* 0x20040000-0x3fffffff: SRAM3 (STM32L4R9xx only, 384k) */
|
#define STM32L4_SRAM3_BASE 0x20040000 /* 0x20040000-0x3fffffff: SRAM3 (STM32L4R9xx only, 384k) */
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ int stm32l4_firewallsetup(FAR struct stm32l4_firewall_t *setup)
|
|||||||
{
|
{
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
|
|
||||||
/* code and nvdata must be aligned to 256 bytes
|
/* Code and nvdata must be aligned to 256 bytes
|
||||||
* data must be aligned to 64 bytes
|
* data must be aligned to 64 bytes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ int stm32l4_firewallsetup(FAR struct stm32l4_firewall_t *setup)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* code and nvdata length must be a multiple of 256 bytes
|
/* Code and nvdata length must be a multiple of 256 bytes
|
||||||
* data length must be a multiple of 64 bytes
|
* data length must be a multiple of 64 bytes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -76,16 +76,16 @@ int stm32l4_firewallsetup(FAR struct stm32l4_firewall_t *setup)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* code and nvdata must be in flash
|
/* Code and nvdata must be in flash
|
||||||
* data must be in SRAM1
|
* data must be in SRAM1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((setup->codestart & STM32L4_REGION_MASK) != STM32L4_FLASH_BASE)
|
if ((setup->codestart & STM32L4_FLASH_MASK) != STM32L4_FLASH_BASE)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setup->nvdatastart & STM32L4_REGION_MASK) != STM32L4_FLASH_BASE)
|
if ((setup->nvdatastart & STM32L4_FLASH_MASK) != STM32L4_FLASH_BASE)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user