Skip to content

Commit 57167d1

Browse files
committed
Fix address alignment check in EraseFlash (close #5)
1 parent 973a8cf commit 57167d1

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/mcc_generated_files/boot/boot_process.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ Copyright (c) [2012-2019] Microchip Technology Inc.
6565

6666
#include "boot_config.h"
6767

68-
#ifndef FLASH_ERASE_PAGE_MASK
69-
#define FLASH_ERASE_PAGE_MASK (~((FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2) - 1))
70-
#endif
71-
7268

7369
#if ((BOOT_CONFIG_MAX_PACKET_SIZE - SIZE_OF_CMD_STRUCT_0) < MINIMUM_WRITE_BLOCK_SIZE )
7470
#error "The maximum packet size is not large enough to store a full write block plus header. Make the max packet size larger."

src/mcc_generated_files/memory/flash.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
#include <stdint.h>
2929
#include <stdbool.h>
3030

31-
#define FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS 1024U
31+
#define FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS 1024UL
3232

33-
#define FLASH_ERASE_PAGE_SIZE_IN_PC_UNITS (FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2U)
33+
#define FLASH_ERASE_PAGE_SIZE_IN_PC_UNITS (FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2UL)
3434

3535
#define FLASH_UNLOCK_KEY 0x00AA0055
3636

37-
#define FLASH_ERASE_PAGE_MASK (~((FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2U) - 1U))
37+
#define FLASH_ERASE_PAGE_MASK (~((FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2UL) - 1UL))
3838
void FLASH_Unlock(uint32_t key);
3939
void FLASH_Lock(void);
4040

0 commit comments

Comments
 (0)