1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

cpu/msp430_common: specify FLASHPAGE_SIZE/NUMOF type

- Since msp430 uses 16bit it is important that the variables
  are treated as unsigned and not int so FLASHPAGE_NUMOF*FLASHPAGE_SIZE
  doesn't overflow
This commit is contained in:
Francisco Molina 2019-08-05 14:04:30 +02:00
parent 22177258df
commit 291727c9e7
2 changed files with 4 additions and 4 deletions

View File

@ -26,11 +26,11 @@ extern "C" {
* @name Configure the internal flash memory
* @{
*/
#define FLASHPAGE_SIZE (512)
#define FLASHPAGE_SIZE (512U)
#if defined (CPU_MODEL_MSP430F1611)
#define CPU_FLASH_BASE (0x4000)
#define FLASHPAGE_NUMOF (96) /* 48K */
#define FLASHPAGE_NUMOF (96U) /* 48K */
#elif defined (CPU_MODEL_MSP430F1612)
#define CPU_FLASH_BASE (0x2600) /* first sector is only 256 byte, skip it*/
#define FLASHPAGE_NUMOF (109U) /* 54.5K */
@ -39,7 +39,7 @@ extern "C" {
#define FLASHPAGE_NUMOF (103U) /* we can currently only access 51.5K */
#elif defined (CPU_MODEL_CC430F6137)
#define CPU_FLASH_BASE (0x8000)
#define FLASHPAGE_NUMOF (64) /* 32K */
#define FLASHPAGE_NUMOF (64U) /* 32K */
#endif
/** @} */

View File

@ -26,7 +26,7 @@
void flashpage_write(int page, const void *data)
{
assert(page < FLASHPAGE_NUMOF);
assert((unsigned) page < FLASHPAGE_NUMOF);
const uint8_t *src = data;
uint8_t *dst = (uint8_t *)flashpage_addr(page);