Adopt CCRH compiler

This commit is contained in:
Sergey Lyubka 2024-02-22 17:53:15 +00:00
parent 01ae80ecd1
commit 112a1e908a
6 changed files with 20 additions and 12 deletions

View File

@ -664,7 +664,7 @@ MG_IRAM bool mg_flash_erase(void *addr) {
return ok; return ok;
} }
MG_IRAM bool mg_flash_swap_bank() { MG_IRAM bool mg_flash_swap_bank(void) {
return true; return true;
} }
@ -1007,7 +1007,7 @@ MG_IRAM bool mg_flash_erase(void *addr) {
return ok; return ok;
} }
MG_IRAM bool mg_flash_swap_bank() { MG_IRAM bool mg_flash_swap_bank(void) {
if (mg_flash_bank() == 0) return true; if (mg_flash_bank() == 0) return true;
uint32_t bank = FLASH_BASE1; uint32_t bank = FLASH_BASE1;
uint32_t desired = flash_bank_is_swapped(bank) ? 0 : MG_BIT(31); uint32_t desired = flash_bank_is_swapped(bank) ? 0 : MG_BIT(31);

View File

@ -1056,8 +1056,8 @@ uint64_t mg_now(void); // Return milliseconds since Epoch
#define mg_htonl(x) mg_ntohl(x) #define mg_htonl(x) mg_ntohl(x)
#define MG_U32(a, b, c, d) \ #define MG_U32(a, b, c, d) \
(((uint32_t) ((a) &255) << 24) | ((uint32_t) ((b) &255) << 16) | \ (((uint32_t) ((a) & 255) << 24) | ((uint32_t) ((b) & 255) << 16) | \
((uint32_t) ((c) &255) << 8) | (uint32_t) ((d) &255)) ((uint32_t) ((c) & 255) << 8) | (uint32_t) ((d) & 255))
// For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip)) // For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip))
#define MG_U8P(ADDR) ((uint8_t *) (ADDR)) #define MG_U8P(ADDR) ((uint8_t *) (ADDR))
@ -1071,9 +1071,12 @@ uint64_t mg_now(void); // Return milliseconds since Epoch
#define MG_ROUND_UP(x, a) ((a) == 0 ? (x) : ((((x) + (a) -1) / (a)) * (a))) #define MG_ROUND_UP(x, a) ((a) == 0 ? (x) : ((((x) + (a) -1) / (a)) * (a)))
#define MG_ROUND_DOWN(x, a) ((a) == 0 ? (x) : (((x) / (a)) * (a))) #define MG_ROUND_DOWN(x, a) ((a) == 0 ? (x) : (((x) / (a)) * (a)))
#ifdef __GNUC__ #if defined(__GNUC__)
#define MG_ARM_DISABLE_IRQ() asm volatile("cpsid i" : : : "memory") #define MG_ARM_DISABLE_IRQ() asm volatile("cpsid i" : : : "memory")
#define MG_ARM_ENABLE_IRQ() asm volatile("cpsie i" : : : "memory") #define MG_ARM_ENABLE_IRQ() asm volatile("cpsie i" : : : "memory")
#elif defined(__CCRH__)
#define MG_RH850_DISABLE_IRQ() __DI()
#define MG_RH850_ENABLE_IRQ() __EI()
#else #else
#define MG_ARM_DISABLE_IRQ() #define MG_ARM_DISABLE_IRQ()
#define MG_ARM_ENABLE_IRQ() #define MG_ARM_ENABLE_IRQ()
@ -2676,6 +2679,7 @@ MG_IRAM void mg_ota_boot(void); // Bootloader function
#define MG_DEVICE_RT1020 3 // IMXRT1020 #define MG_DEVICE_RT1020 3 // IMXRT1020
#define MG_DEVICE_RT1060 4 // IMXRT1060 #define MG_DEVICE_RT1060 4 // IMXRT1060
#define MG_DEVICE_CH32V307 100 // WCH CH32V307 #define MG_DEVICE_CH32V307 100 // WCH CH32V307
#define MG_DEVICE_U2A 200 // Renesas U2A16, U2A8, U2A6
#define MG_DEVICE_CUSTOM 1000 // Custom implementation #define MG_DEVICE_CUSTOM 1000 // Custom implementation
#ifndef MG_DEVICE #ifndef MG_DEVICE

View File

@ -11,6 +11,7 @@
#define MG_DEVICE_RT1020 3 // IMXRT1020 #define MG_DEVICE_RT1020 3 // IMXRT1020
#define MG_DEVICE_RT1060 4 // IMXRT1060 #define MG_DEVICE_RT1060 4 // IMXRT1060
#define MG_DEVICE_CH32V307 100 // WCH CH32V307 #define MG_DEVICE_CH32V307 100 // WCH CH32V307
#define MG_DEVICE_U2A 200 // Renesas U2A16, U2A8, U2A6
#define MG_DEVICE_CUSTOM 1000 // Custom implementation #define MG_DEVICE_CUSTOM 1000 // Custom implementation
#ifndef MG_DEVICE #ifndef MG_DEVICE

View File

@ -249,7 +249,7 @@ MG_IRAM bool mg_flash_erase(void *addr) {
return ok; return ok;
} }
MG_IRAM bool mg_flash_swap_bank() { MG_IRAM bool mg_flash_swap_bank(void) {
return true; return true;
} }

View File

@ -104,7 +104,7 @@ MG_IRAM bool mg_flash_erase(void *addr) {
return ok; return ok;
} }
MG_IRAM bool mg_flash_swap_bank() { MG_IRAM bool mg_flash_swap_bank(void) {
if (mg_flash_bank() == 0) return true; if (mg_flash_bank() == 0) return true;
uint32_t bank = FLASH_BASE1; uint32_t bank = FLASH_BASE1;
uint32_t desired = flash_bank_is_swapped(bank) ? 0 : MG_BIT(31); uint32_t desired = flash_bank_is_swapped(bank) ? 0 : MG_BIT(31);

View File

@ -24,8 +24,8 @@ uint64_t mg_now(void); // Return milliseconds since Epoch
#define mg_htonl(x) mg_ntohl(x) #define mg_htonl(x) mg_ntohl(x)
#define MG_U32(a, b, c, d) \ #define MG_U32(a, b, c, d) \
(((uint32_t) ((a) &255) << 24) | ((uint32_t) ((b) &255) << 16) | \ (((uint32_t) ((a) & 255) << 24) | ((uint32_t) ((b) & 255) << 16) | \
((uint32_t) ((c) &255) << 8) | (uint32_t) ((d) &255)) ((uint32_t) ((c) & 255) << 8) | (uint32_t) ((d) & 255))
// For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip)) // For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip))
#define MG_U8P(ADDR) ((uint8_t *) (ADDR)) #define MG_U8P(ADDR) ((uint8_t *) (ADDR))
@ -39,9 +39,12 @@ uint64_t mg_now(void); // Return milliseconds since Epoch
#define MG_ROUND_UP(x, a) ((a) == 0 ? (x) : ((((x) + (a) -1) / (a)) * (a))) #define MG_ROUND_UP(x, a) ((a) == 0 ? (x) : ((((x) + (a) -1) / (a)) * (a)))
#define MG_ROUND_DOWN(x, a) ((a) == 0 ? (x) : (((x) / (a)) * (a))) #define MG_ROUND_DOWN(x, a) ((a) == 0 ? (x) : (((x) / (a)) * (a)))
#ifdef __GNUC__ #if defined(__GNUC__)
#define MG_ARM_DISABLE_IRQ() asm volatile("cpsid i" : : : "memory") #define MG_ARM_DISABLE_IRQ() asm volatile("cpsid i" : : : "memory")
#define MG_ARM_ENABLE_IRQ() asm volatile("cpsie i" : : : "memory") #define MG_ARM_ENABLE_IRQ() asm volatile("cpsie i" : : : "memory")
#elif defined(__CCRH__)
#define MG_RH850_DISABLE_IRQ() __DI()
#define MG_RH850_ENABLE_IRQ() __EI()
#else #else
#define MG_ARM_DISABLE_IRQ() #define MG_ARM_DISABLE_IRQ()
#define MG_ARM_ENABLE_IRQ() #define MG_ARM_ENABLE_IRQ()