From 098eccc05729b06f8e4af060d702308f6596b9c8 Mon Sep 17 00:00:00 2001 From: bigmagic Date: Fri, 17 Apr 2020 22:16:34 +0800 Subject: [PATCH 1/3] add raspi3-64 readme note --- bsp/raspberry-pi/raspi3-64/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bsp/raspberry-pi/raspi3-64/README.md b/bsp/raspberry-pi/raspi3-64/README.md index 576b13ed0e..a8558d809e 100644 --- a/bsp/raspberry-pi/raspi3-64/README.md +++ b/bsp/raspberry-pi/raspi3-64/README.md @@ -31,6 +31,16 @@ EXEC_PATH = r'E:/env_released_1.1.2/env/tools/gnu_gcc/arm_gcc/gcc-arm-8.3-2019.0 然后在`bsp\raspberry-pi\raspi3-64\`下输入scons编译即可。 +**window环境搭建注意** + +下载完成`gcc-arm-8.3-2019.03-i686-mingw32-aarch64-elf.tar.xz`交叉编译工具链后,最好采用7-zip解压工具进行两次解压。 +确保解压目录下的`/bin/aarch64-elf-ld.exe`文件的size不为0。 +否则编译会出现如下错误: + +``` +collect2.exe:fatal error:CreateProcess:No such file or directory +``` + ### 2.2 Linux上的环境搭建 Linux下推荐使用[gcc工具][2]。Linux版本下gcc版本可采用`gcc-arm-8.3-2019.03-x86_64-aarch64-elf`。 From bcae19654162c80a8f2380794189c7b4ec242c90 Mon Sep 17 00:00:00 2001 From: bigmagic Date: Fri, 17 Apr 2020 22:19:54 +0800 Subject: [PATCH 2/3] [bsp\raspi4]move io to `iomap.h` --- bsp/raspberry-pi/raspi4/driver/board.c | 8 ++------ bsp/raspberry-pi/raspi4/driver/board.h | 2 +- bsp/raspberry-pi/raspi4/driver/drv_gpio.h | 2 -- bsp/raspberry-pi/raspi4/driver/drv_uart.c | 6 ------ bsp/raspberry-pi/raspi4/driver/drv_uart.h | 1 - bsp/raspberry-pi/raspi4/driver/iomap.h | 21 ++++++++++++++++++--- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/bsp/raspberry-pi/raspi4/driver/board.c b/bsp/raspberry-pi/raspi4/driver/board.c index 46d629a35d..79a24d184f 100644 --- a/bsp/raspberry-pi/raspi4/driver/board.c +++ b/bsp/raspberry-pi/raspi4/driver/board.c @@ -18,10 +18,6 @@ #include "mmu.h" static rt_uint64_t timerStep; -// 0x40, 0x44, 0x48, 0x4c: Core 0~3 Timers interrupt control -#define CORE0_TIMER_IRQ_CTRL HWREG32(0xFF800040) -#define TIMER_IRQ 30 -#define NON_SECURE_TIMER_IRQ (1 << 1) int rt_hw_get_gtimer_frq(void); void rt_hw_set_gtimer_val(rt_uint64_t value); @@ -29,7 +25,7 @@ int rt_hw_get_gtimer_val(void); int rt_hw_get_cntpct_val(void); void rt_hw_gtimer_enable(void); -void core0_timer_enable_interrupt_controller() +void core0_timer_enable_interrupt_controller(void) { CORE0_TIMER_IRQ_CTRL |= NON_SECURE_TIMER_IRQ; } @@ -94,4 +90,4 @@ void rt_hw_board_init(void) #ifdef RT_USING_COMPONENTS_INIT rt_components_board_init(); #endif -} \ No newline at end of file +} diff --git a/bsp/raspberry-pi/raspi4/driver/board.h b/bsp/raspberry-pi/raspi4/driver/board.h index 66805464f2..a7c96b3276 100644 --- a/bsp/raspberry-pi/raspi4/driver/board.h +++ b/bsp/raspberry-pi/raspi4/driver/board.h @@ -12,6 +12,7 @@ #define BOARD_H__ #include +#include "iomap.h" extern unsigned char __bss_start; extern unsigned char __bss_end; @@ -22,4 +23,3 @@ extern unsigned char __bss_end; void rt_hw_board_init(void); #endif - diff --git a/bsp/raspberry-pi/raspi4/driver/drv_gpio.h b/bsp/raspberry-pi/raspi4/driver/drv_gpio.h index ebc9452cec..c4658fcebb 100644 --- a/bsp/raspberry-pi/raspi4/driver/drv_gpio.h +++ b/bsp/raspberry-pi/raspi4/driver/drv_gpio.h @@ -17,8 +17,6 @@ #include "board.h" #include "interrupt.h" -#define GPIO_BASE (0xFE000000 + 0x00200000) - #define GPIO_REG_GPFSEL0(BASE) HWREG32(BASE + 0x00) #define GPIO_REG_GPFSEL1(BASE) HWREG32(BASE + 0x04) #define GPIO_REG_GPFSEL2(BASE) HWREG32(BASE + 0x08) diff --git a/bsp/raspberry-pi/raspi4/driver/drv_uart.c b/bsp/raspberry-pi/raspi4/driver/drv_uart.c index a7ac1b5892..6a70cdfb3a 100644 --- a/bsp/raspberry-pi/raspi4/driver/drv_uart.c +++ b/bsp/raspberry-pi/raspi4/driver/drv_uart.c @@ -16,12 +16,6 @@ #include "drv_uart.h" #include "drv_gpio.h" -#define UART0_BASE (0xFE000000 + 0x00201000) -#define PL011_BASE UART0_BASE -#define IRQ_PL011 (121 + 32) - -#define UART_REFERENCE_CLOCK 48000000 - struct hw_uart_device { rt_ubase_t hw_base; diff --git a/bsp/raspberry-pi/raspi4/driver/drv_uart.h b/bsp/raspberry-pi/raspi4/driver/drv_uart.h index 4f23d7b46e..714043efd3 100644 --- a/bsp/raspberry-pi/raspi4/driver/drv_uart.h +++ b/bsp/raspberry-pi/raspi4/driver/drv_uart.h @@ -81,4 +81,3 @@ int rt_hw_uart_init(void); #endif /* DRV_UART_H__ */ - diff --git a/bsp/raspberry-pi/raspi4/driver/iomap.h b/bsp/raspberry-pi/raspi4/driver/iomap.h index 675cd147e3..3f18353904 100644 --- a/bsp/raspberry-pi/raspi4/driver/iomap.h +++ b/bsp/raspberry-pi/raspi4/driver/iomap.h @@ -1,8 +1,23 @@ #ifndef __RASPI4_H__ #define __RASPI4_H__ -#define ARM_GIC_NR_IRQS 512 -#define INTC_BASE 0xff800000 +//gpio +#define GPIO_BASE (0xFE000000 + 0x00200000) + +//uart +#define UART0_BASE (0xFE000000 + 0x00201000) +#define PL011_BASE UART0_BASE +#define IRQ_PL011 (121 + 32) +#define UART_REFERENCE_CLOCK (48000000) + +// 0x40, 0x44, 0x48, 0x4c: Core 0~3 Timers interrupt control +#define CORE0_TIMER_IRQ_CTRL HWREG32(0xFF800040) +#define TIMER_IRQ 30 +#define NON_SECURE_TIMER_IRQ (1 << 1) + +//gic max +#define ARM_GIC_NR_IRQS (512) +#define INTC_BASE (0xff800000) #define GIC_V2_DISTRIBUTOR_BASE (INTC_BASE + 0x00041000) #define GIC_V2_CPU_INTERFACE_BASE (INTC_BASE + 0x00042000) #define GIC_V2_HYPERVISOR_BASE (INTC_BASE + 0x00044000) @@ -11,4 +26,4 @@ #define GIC_PL400_DISTRIBUTOR_PPTR GIC_V2_DISTRIBUTOR_BASE #define GIC_PL400_CONTROLLER_PPTR GIC_V2_CPU_INTERFACE_BASE -#endif \ No newline at end of file +#endif From 3afb24f4c1f7530887a9f3f981bc0fdd3961c44c Mon Sep 17 00:00:00 2001 From: bigmagic Date: Fri, 17 Apr 2020 22:30:41 +0800 Subject: [PATCH 3/3] fix aarch64 compiler warning --- components/finsh/finsh.h | 4 ++-- components/finsh/finsh_compiler.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h index eb38682c4f..7276ea7ce1 100644 --- a/components/finsh/finsh.h +++ b/components/finsh/finsh.h @@ -27,8 +27,8 @@ #define HEAP_ALIGNMENT 4 /* heap alignment */ #define FINSH_GET16(x) (*(x)) | (*((x)+1) << 8) -#define FINSH_GET32(x) (rt_uint32_t)(*(x)) | ((rt_uint32_t)*((x)+1) << 8) | \ - ((rt_uint32_t)*((x)+2) << 16) | ((rt_uint32_t)*((x)+3) << 24) +#define FINSH_GET32(x) (rt_ubase_t)(*(x)) | ((rt_ubase_t)*((x)+1) << 8) | \ + ((rt_ubase_t)*((x)+2) << 16) | ((rt_ubase_t)*((x)+3) << 24) #define FINSH_SET16(x, v) \ do \ diff --git a/components/finsh/finsh_compiler.c b/components/finsh/finsh_compiler.c index 8d33e0e567..f81409bf9a 100644 --- a/components/finsh/finsh_compiler.c +++ b/components/finsh/finsh_compiler.c @@ -191,7 +191,7 @@ static int finsh_compile(struct finsh_node* node) case FINSH_NODE_VALUE_NULL: case FINSH_NODE_VALUE_STRING: finsh_code_byte(FINSH_OP_LD_DWORD); - finsh_code_dword((uint32_t)node->value.ptr); + finsh_code_dword((rt_ubase_t)node->value.ptr); break; /* arithmetic operation */