For the hal_flash API's make the change to uintptr_t to support 64-bit explicit using `ARCH_64BIT` or known 64-bit architectures.

pull/339/head
David Garske 2023-08-04 14:04:19 -07:00 committed by Daniele Lacamera
parent 7190392245
commit b9949b0a0c
6 changed files with 22 additions and 15 deletions

View File

@ -532,7 +532,7 @@ void hal_init(void)
#endif #endif
} }
int hal_flash_write(uintptr_t address, const uint8_t *data, int len) int hal_flash_write(uint32_t address, const uint8_t *data, int len)
{ {
(void)address; (void)address;
(void)data; (void)data;
@ -541,7 +541,7 @@ int hal_flash_write(uintptr_t address, const uint8_t *data, int len)
return 0; return 0;
} }
int hal_flash_erase(uintptr_t address, int len) int hal_flash_erase(uint32_t address, int len)
{ {
(void)address; (void)address;
(void)len; (void)len;

View File

@ -45,13 +45,20 @@ void hal_set_external_flash_file(const char* file);
void hal_deinit(); void hal_deinit();
#endif #endif
#if !defined(ARCH_64BIT) && \
(defined(ARCH_x86_64) || defined(ARCH_AARCH64) || defined(ARCH_SIM))
#define ARCH_64BIT
#endif
void hal_init(void); void hal_init(void);
#if !defined(FORCE_32BIT) && INTPTR_MAX == INT64_MAX /* 64-bit platform */ #ifdef ARCH_64BIT
int hal_flash_write(uintptr_t address, const uint8_t *data, int len); typedef uintptr_t haladdr_t; /* 64-bit platforms */
int hal_flash_erase(uintptr_t address, int len); int hal_flash_write(uintptr_t address, const uint8_t *data, int len);
int hal_flash_erase(uintptr_t address, int len);
#else #else
int hal_flash_write(uint32_t address, const uint8_t *data, int len); typedef uint32_t haladdr_t; /* original 32-bit */
int hal_flash_erase(uint32_t address, int len); int hal_flash_write(uint32_t address, const uint8_t *data, int len);
int hal_flash_erase(uint32_t address, int len);
#endif #endif
void hal_flash_unlock(void); void hal_flash_unlock(void);
void hal_flash_lock(void); void hal_flash_lock(void);

View File

@ -32,11 +32,11 @@ static int locked = 0;
void hal_init(void) void hal_init(void)
{ {
} }
int hal_flash_write(uintptr_t address, const uint8_t *data, int len) int hal_flash_write(haladdr_t address, const uint8_t *data, int len)
{ {
return 0; return 0;
} }
int hal_flash_erase(uintptr_t address, int len) int hal_flash_erase(haladdr_t address, int len)
{ {
return 0; return 0;
} }

View File

@ -88,7 +88,7 @@ void printmsg(const char *msg)
} }
int hal_flash_write(uintptr_t address, const uint8_t *data, int len) int hal_flash_write(haladdr_t address, const uint8_t *data, int len)
{ {
(void)address; (void)address;
(void)data; (void)data;
@ -96,7 +96,7 @@ int hal_flash_write(uintptr_t address, const uint8_t *data, int len)
return -1; return -1;
} }
int hal_flash_erase(uintptr_t address, int len) int hal_flash_erase(haladdr_t address, int len)
{ {
(void)address; (void)address;
(void)len; (void)len;

View File

@ -68,11 +68,11 @@ static int locked = 0;
void hal_init(void) void hal_init(void)
{ {
} }
int hal_flash_write(uintptr_t address, const uint8_t *data, int len) int hal_flash_write(haladdr_t address, const uint8_t *data, int len)
{ {
return 0; return 0;
} }
int hal_flash_erase(uintptr_t address, int len) int hal_flash_erase(haladdr_t address, int len)
{ {
return 0; return 0;
} }

View File

@ -37,11 +37,11 @@ static int locked = 0;
void hal_init(void) void hal_init(void)
{ {
} }
int hal_flash_write(uintptr_t address, const uint8_t *data, int len) int hal_flash_write(haladdr_t address, const uint8_t *data, int len)
{ {
return 0; return 0;
} }
int hal_flash_erase(uintptr_t address, int len) int hal_flash_erase(haladdr_t address, int len)
{ {
return 0; return 0;
} }