[libcpu][component][debug] add debug info for gdb (#7033)

This commit is contained in:
Shell
2023-05-14 23:48:16 +08:00
committed by GitHub
parent f7337f9db6
commit b7554a70d2
15 changed files with 184 additions and 100 deletions
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2006-2023 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-03-12 WangXiaoyao the first version
*/
#ifndef __ASM_GENERIC_H__
#define __ASM_GENERIC_H__
#define START_POINT(funcname) \
.type funcname, %function; \
.global funcname; \
funcname: \
.cfi_sections .debug_frame, .eh_frame; \
.cfi_startproc; \
.cfi_undefined lr
#define START_POINT_END(name) \
.cfi_endproc; \
.size name, .-name;
#endif /* __ASM_GENERIC_H__ */
+2
View File
@@ -97,4 +97,6 @@ rt_inline void rt_hw_dsb(void)
__asm volatile ("dsb":::"memory");
}
void _thread_start(void);
#endif /*CPUPORT_H__*/
+3 -3
View File
@@ -35,7 +35,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
stack_addr += sizeof(rt_uint32_t);
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
stk = (rt_uint32_t *)stack_addr;
*(--stk) = (rt_uint32_t)tentry; /* entry point */
*(--stk) = (rt_uint32_t)_thread_start; /* entry point */
*(--stk) = (rt_uint32_t)texit; /* lr */
*(--stk) = 0xdeadbeef; /* r12 */
*(--stk) = 0xdeadbeef; /* r11 */
@@ -48,8 +48,8 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
*(--stk) = 0xdeadbeef; /* r4 */
*(--stk) = 0xdeadbeef; /* r3 */
*(--stk) = 0xdeadbeef; /* r2 */
*(--stk) = 0xdeadbeef; /* r1 */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
*(--stk) = (rt_uint32_t)tentry; /* r1 : argument 2 for trampoline */
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument 1 */
/* cpsr */
if ((rt_uint32_t)tentry & 0x01)
*(--stk) = SVCMODE | 0x20; /* thumb mode */
+9
View File
@@ -673,6 +673,15 @@ rt_hw_clz:
#define RT_CPUS_NR 1
#endif
#include "asm-generic.h"
START_POINT(_thread_start)
mov r10, lr
blx r1
blx r10
b . /* never here */
START_POINT_END(_thread_start)
.bss
.align 3 /* align to 2~3=8 */
svc_stack_n: