03-01-2022, 09:58 AM
I fixed it.
In my case, I use some sections of flash.
Exsample:
.syntax unified
.arch armv7-m
.thumb
.thumb_func
// .section .fixedcode
//---------------------------------
// mcpy
//---------------------------------
.align 4
.globl mcpy
.type mcpy, %function
mcpy:
cmp R2,#4
blo mcpy_last_bytes
ldr R3,[R1],#4
str R3,[R0],#4
subs R2,#4
b mcpy
mcpy_last_bytes:
cbz R2,mcpy_finish
ldrb R3,[R1],#1
strb R3,[R0],#1
subs R2,#1
b mcpy_last_bytes
mcpy_finish:
bx lr
If uncomment the line // .section .fixedcode the debug not work in this source file
linker script:
SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
KEEP(*(.fixedcode))
. = 0x4000;
KEEP(*(.calltable))
. = 0x4100;
*(.text*)
*(.rodata*)
} > ROM
...
In my case, I use some sections of flash.
Exsample:
.syntax unified
.arch armv7-m
.thumb
.thumb_func
// .section .fixedcode
//---------------------------------
// mcpy
//---------------------------------
.align 4
.globl mcpy
.type mcpy, %function
mcpy:
cmp R2,#4
blo mcpy_last_bytes
ldr R3,[R1],#4
str R3,[R0],#4
subs R2,#4
b mcpy
mcpy_last_bytes:
cbz R2,mcpy_finish
ldrb R3,[R1],#1
strb R3,[R0],#1
subs R2,#1
b mcpy_last_bytes
mcpy_finish:
bx lr
If uncomment the line // .section .fixedcode the debug not work in this source file
linker script:
SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
KEEP(*(.fixedcode))
. = 0x4000;
KEEP(*(.calltable))
. = 0x4100;
*(.text*)
*(.rodata*)
} > ROM
...