解决gcc15的编译问题

This commit is contained in:
2025-03-31 17:15:06 +08:00
parent 3d38858db3
commit f9666deb0d
8 changed files with 17 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ kernel_version = "3.0.0"
board_cpu = "" board_cpu = ""
# Board arch, e.g. "armv7-a", "rv32imac". # Board arch, e.g. "armv7-a", "rv32imac".
board_arch = "rv32i" board_arch = "rv32imc_zicsr"
# Toolchain name used for system compiling. # Toolchain name used for system compiling.
# E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf.
@@ -57,7 +57,11 @@ board_cflags = [
"-fno-short-enums", "-fno-short-enums",
"-D__LITEOS__M", "-D__LITEOS__M",
"-nostartfiles", "-nostartfiles",
"-mstrict-align" "-mstrict-align",
"-Wno-error=incompatible-pointer-types",
"-Wno-error=implicit-function-declaration",
"-Wno-error=maybe-uninitialized",
"-Wno-error=int-in-bool-context"
] ]
board_cxx_flags = board_cflags board_cxx_flags = board_cflags

View File

@@ -28,6 +28,7 @@
#include "iot_gpio.h" #include "iot_gpio.h"
#include "iot_errno_api.h" #include "iot_errno_api.h"
#include "iot_mtd.h" #include "iot_mtd.h"
#include "iot_gpio_api.h"
#include "read_flash.h" #include "read_flash.h"
@@ -49,7 +50,7 @@ void LwipTestTimeoutCallback(void const *argument)
iot_printf("TT\n"); iot_printf("TT\n");
} }
uint32_t g_lwipTestTimerId = NULL; uint32_t g_lwipTestTimerId = 0;
void LwipTestStartTimer() void LwipTestStartTimer()
{ {
uint32_t status; uint32_t status;

View File

@@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "stdint.h"
#include "read_flash.h" #include "read_flash.h"

View File

@@ -145,7 +145,7 @@ void os_heap_alloc_caps_init(unsigned int reserved_sz)
g_reserved_part = os_mem_malloc(IOT_CLI_MID, reserved_sz); g_reserved_part = os_mem_malloc(IOT_CLI_MID, reserved_sz);
} }
return ret; return;
} }
uint32_t os_heap_alloc_get_reserved_part_info(uint32_t *addr) uint32_t os_heap_alloc_get_reserved_part_info(uint32_t *addr)

View File

@@ -172,7 +172,7 @@ void os_set_task_prio_ext(os_task_h handle, uint8_t prio)
if (!ISVALID_LOS_PRIORITY(priority)) { if (!ISVALID_LOS_PRIORITY(priority)) {
/* unsupported priority */ /* unsupported priority */
return NULL; return;
} }
LOS_TaskPriSet((uint32_t)handle, priority); LOS_TaskPriSet((uint32_t)handle, priority);
@@ -189,7 +189,7 @@ void os_set_task_prio(os_task_h handle, uint8_t prio)
if (!ISVALID_LOS_PRIORITY(priority)) { if (!ISVALID_LOS_PRIORITY(priority)) {
/* unsupported priority */ /* unsupported priority */
return NULL; return;
} }
LOS_TaskPriSet((uint32_t)handle, priority); LOS_TaskPriSet((uint32_t)handle, priority);

View File

@@ -140,7 +140,7 @@ void os_delete_timer(timer_id_t id)
{ {
SWTMR_CTRL_S *swtmr = (SWTMR_CTRL_S *)id; SWTMR_CTRL_S *swtmr = (SWTMR_CTRL_S *)id;
os_mem_free(swtmr->uwArg); os_mem_free((void *)swtmr->uwArg);
LOS_SwtmrDelete(swtmr->usTimerID); LOS_SwtmrDelete(swtmr->usTimerID);
} }

View File

@@ -211,10 +211,10 @@ uint32_t IRAM_ATTR wdg_timeout_handler(uint32_t vector, iot_addrword_t data)
uintptr_t mbadaddr = 0, mepc = 0, mcause = 0; uintptr_t mbadaddr = 0, mepc = 0, mcause = 0;
mbadaddr = 0xdeadfeed; mbadaddr = 0xdeadfeed;
__asm volatile ( "csrc mstatus, 8" ); __asm volatile ( "csrc mstatus, 8" );
__asm volatile ( "csrw mbadaddr, %0" :: "r"(mbadaddr) ); __asm volatile ( "csrw mtval, %0" :: "r"(mbadaddr) );
__asm volatile ( "csrr %0, mepc" : "=r"(mepc) ); __asm volatile ( "csrr %0, mepc" : "=r"(mepc) );
__asm volatile ( "csrr %0, mcause" : "=r"(mcause) ); __asm volatile ( "csrr %0, mcause" : "=r"(mcause) );
iot_sprintf(buf, "mcause: 0x%08x, mepc: 0x%08x, mbadaddr: 0x%08x\n", iot_sprintf(buf, "mcause: 0x%08x, mepc: 0x%08x, mtval: 0x%08x\n",
mcause, mepc, mbadaddr); mcause, mepc, mbadaddr);
print_cache_error_msg(buf); print_cache_error_msg(buf);
iot_interrupt_mask(wdg->handle); iot_interrupt_mask(wdg->handle);

View File

@@ -469,7 +469,7 @@ void IRAM_ATTR exception_handler(uintptr_t mcause, uintptr_t epc, saved_register
//disble global interrupt; //disble global interrupt;
__asm volatile ( "csrc mstatus,8" ); __asm volatile ( "csrc mstatus,8" );
__asm volatile ( "csrr %0, mbadaddr" : "=r"(mbadaddr)); __asm volatile ( "csrr %0, mtval" : "=r"(mbadaddr));
asm volatile ( "csrr %0, mcause" : "=r"(curr_mcause)); asm volatile ( "csrr %0, mcause" : "=r"(curr_mcause));
asm volatile ( "csrr %0, mip" : "=r"(curr_mip)); asm volatile ( "csrr %0, mip" : "=r"(curr_mip));