环境配置及启动芯片
Ubuntu20.04
env工具
官方有提供gcc的启动文件及链接文件,但移植到rt-thread的不能启动mm32f5265,然后修改了启动文件及链接文件;
启动文件修改的地方:
.thumb_func
.type Reset_Handler, %function
.globl Reset_Handler
.fnstart
Reset_Handler:
ldr sp, =_estack /* set stack pointer */
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2], #4
LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system initialization function.*/
bl SystemInit
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl entry
bx lr
LoopForever:
b LoopForever
.fnend
.size Reset_Handler, . - Reset_Handler
链接文件主要修改的地方:
.text :
{
. = ALIGN(4);
KEEP(*(.vectors))
. = ALIGN(4);
*(.text) /* remaining code */
*(.text.*) /* remaining code */
*(.rodata) /* read-only data (constants) */
*(.rodata*)
*(.glue_7)
*(.glue_7t)
*(.gnu.linkonce.t*)
/* section information for finsh shell */
. = ALIGN(4);
__fsymtab_start = .;
KEEP(*(FSymTab))
__fsymtab_end = .;
. = ALIGN(4);
__vsymtab_start = .;
KEEP(*(VSymTab))
__vsymtab_end = .;
/* section information for initial. */
. = ALIGN(4);
__rt_init_start = .;
KEEP(*(SORT(.rti_fn*)))
__rt_init_end = .;
. = ALIGN(4);
PROVIDE(__ctors_start__ = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE(__ctors_end__ = .);
. = ALIGN(4);
_etext = .;
} > FLASH
适配rt-thread的控制台,从隔壁的mm32f327x里面复制一份drv_uart.c文件过来,添加uart3的支持,根据Mini-F5265-OB开发板的原理图修改uart3的引脚;
,修改Kconfig文件;
编译及烧录
pkgs --update
scons -j8
编译的log如下:
CC build/packages/mm32/HAL_Lib/Src/hal_wwdg.o
AS build/packages/mm32/System/startup_mm32f5260_gcc.o
CC build/packages/mm32/System/system_mm32f526x.o
LINK rtthread.elf
Memory region Used Size Region Size %age Used
FLASH: 83912 B 256 KB 32.01%
RAM: 8656 B 112 KB 7.55%
arm-none-eabi-objcopy -O binary rtthread.elf rtthread.bin
arm-none-eabi-objcopy -O ihex rtthread.elf rtthread.hex
arm-none-eabi-size rtthread.elf
text data bss dec hex filename
83912 1988 6668 92568 16998 rtthread.elf
scons: done building targets.
使用pyocd工具进行烧录:
pyocd flash --erase chip --target MM32F5265E8PV --pack MindMotion.MM32F5260_DFP.0.2.0.pack rtthread.hex
运行效果
\ | /
- RT - Thread Operating System
/ | \ 5.2.0 build Jan 22 2025 11:45:14
2006 - 2024 Copyright by RT-Thread team
msh >
RT-Thread shell commands:
at24cxx - at24cxx eeprom function
adc - adc [option]
pin - pin [option]
clear - clear the terminal screen
version - show RT-Thread version information
list - list objects
help - RT-Thread shell help
ps - List threads in the system
free - Show the memory usage in the system
backtrace - print backtrace of a thread
msh >list de
device
msh >list device
device type ref count
-------- -------------------- ----------
i2c1 I2C Bus 0
adc1 ADC Device 0
uart3 Character Device 2
pin Pin Device 0
msh >
结尾
应经移植了uart、ADC、pin设备,由于年末没有时间移植其他的外设,等待工作没有那么忙在弄了,提前祝大家新年快乐,万事如意!
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/weixin_47569031/article/details/148957026
|