Skip to content

Commit

Permalink
Fix address alignment check in EraseFlash (close #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
bessman committed Dec 23, 2024
1 parent 973a8cf commit 57167d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/mcc_generated_files/boot/boot_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ Copyright (c) [2012-2019] Microchip Technology Inc.

#include "boot_config.h"

#ifndef FLASH_ERASE_PAGE_MASK
#define FLASH_ERASE_PAGE_MASK (~((FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2) - 1))
#endif


#if ((BOOT_CONFIG_MAX_PACKET_SIZE - SIZE_OF_CMD_STRUCT_0) < MINIMUM_WRITE_BLOCK_SIZE )
#error "The maximum packet size is not large enough to store a full write block plus header. Make the max packet size larger."
Expand Down
6 changes: 3 additions & 3 deletions src/mcc_generated_files/memory/flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
#include <stdint.h>
#include <stdbool.h>

#define FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS 1024U
#define FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS 1024UL

#define FLASH_ERASE_PAGE_SIZE_IN_PC_UNITS (FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2U)
#define FLASH_ERASE_PAGE_SIZE_IN_PC_UNITS (FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2UL)

#define FLASH_UNLOCK_KEY 0x00AA0055

#define FLASH_ERASE_PAGE_MASK (~((FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2U) - 1U))
#define FLASH_ERASE_PAGE_MASK (~((FLASH_ERASE_PAGE_SIZE_IN_INSTRUCTIONS*2UL) - 1UL))
void FLASH_Unlock(uint32_t key);
void FLASH_Lock(void);

Expand Down

0 comments on commit 57167d1

Please sign in to comment.