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:
Gregory Nutt
2019-10-02 13:00:55 -06:00
parent 0dbb22f61c
commit a9f2c5e76a
2 changed files with 6 additions and 5 deletions
@@ -68,6 +68,7 @@
/* 0x00100000-0x07ffffff: Reserved */
#define STM32L4_FLASH_BASE 0x08000000 /* 0x08000000-0x080fffff: FLASH memory */
/* 0x08100000-0x0fffffff: Reserved */
#define STM32L4_FLASH_MASK 0xf8000000 /* Test if addr in FLASH */
#define STM32L4_SRAM2_BASE 0x10000000 /* 0x10000000-0x1000ffff: 16k to 64k SRAM2 */
/* 0x10010000-0x1ffeffff: Reserved */
#define STM32L4_SRAM3_BASE 0x20040000 /* 0x20040000-0x3fffffff: SRAM3 (STM32L4R9xx only, 384k) */
+5 -5
View File
@@ -56,7 +56,7 @@ int stm32l4_firewallsetup(FAR struct stm32l4_firewall_t *setup)
{
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
*/
@@ -66,7 +66,7 @@ int stm32l4_firewallsetup(FAR struct stm32l4_firewall_t *setup)
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
*/
@@ -76,16 +76,16 @@ int stm32l4_firewallsetup(FAR struct stm32l4_firewall_t *setup)
return -EINVAL;
}
/* code and nvdata must be in flash
/* Code and nvdata must be in flash
* 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;
}
if ((setup->nvdatastart & STM32L4_REGION_MASK) != STM32L4_FLASH_BASE)
if ((setup->nvdatastart & STM32L4_FLASH_MASK) != STM32L4_FLASH_BASE)
{
return -EINVAL;
}