Hello, I am developing an application with a bootloader area between 0x0-0x2fff and the application starts at 0x3000. When I check the option "Use Memory Layout from Target Dialog" on "Options for Target/Linker" the linker creates a correct applicatin image starting at 0x3000. As I have a third RAM area I had to use a scatter file. With this option the linker does not consider the bootloader area and place the code starting at 0x0. I have also used the Misc Controls as "--ro-base=0x00003000" and R/O Base: as 0x3000 but it did not work.
Which setting is missing? Thanks,
Andre
in the scatter file, you can specify the begin address of the load image in internal flash, like this:
LR_IROM1 0x00004000 0x0000C000 { ; load region size_region ER_IROM1 0x00004000 0x000C0000 { *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) }
your binary will be placed starting at 0x4000.
It is often best to use the menu system and create as good a scatter file as you can, and then manually add the missing parts - in this case the third RAM region.
That way, the scatter file would already have contained the correct start address for the code.
Hello, I have noticed a strange behavior concerning the R/O base address. I have a big RAM vector called safe_buffer.
When I declare safe_buffer to char safe_buffer[0x68B4] the Dissassembly Window in Debug mode is:
--->0x00000000 E59F4018 LDR R4,[PC,#0x0018] 0x00000004 E59F5010 LDR R5,[PC,#0x0010] 0x00000008 E5946000 LDR R6,[R4] 0x0000000C E0056006 AND R6,R5,R6 0x00000010 E5846000 STR R6,[R4] 0x00000014 E51FF004 LDR PC,[PC,#-0x0004] 0x00000018 7FFFE040 SWIVC 0x00FFE040 0x0000001C FFFFBFFF (???) 0x00000020 3FFF8000 SWICC 0x00FF8000 0x00000024 00000000 ANDEQ R0,R0,R0 0x00000028 00000000 ANDEQ R0,R0,R0 0x0000002C 00000000 ANDEQ R0,R0,R0 0x00000030 00000000 ANDEQ R0,R0,R0 0x00000034 00000000 ANDEQ R0,R0,R0 0x00000038 00000000 ANDEQ R0,R0,R0 0x0000003C 00000000 ANDEQ R0,R0,R0
When I declare safe_buffer as char safe_buffer[0x5900], the Dissassembly window is OK:
--->0x00000000 E59FF018 LDR PC,[PC,#0x0018] 0x00000004 E59FF018 LDR PC,[PC,#0x0018] 0x00000008 E59FF018 LDR PC,[PC,#0x0018] 0x0000000C E59FF018 LDR PC,[PC,#0x0018] 0x00000010 E59FF018 LDR PC,[PC,#0x0018] 0x00000014 B9206E50 STMLTDB R0!,{R4,R6,R9-R11,R13-R14} 0x00000018 E51FF120 LDR PC,[PC,#-0x0120] 0x0000001C E59FF018 LDR PC,[PC,#0x0018] 0x00000020 00000054 ANDEQ R0,R0,R4,ASR R0 0x00000024 00000040 ANDEQ R0,R0,R0,ASR #32 0x00000028 40000018 ANDMI R0,R0,R8,LSL R0 0x0000002C 00000044 ANDEQ R0,R0,R4,ASR #32 0x00000030 00000048 ANDEQ R0,R0,R8,ASR #32 0x00000034 00000000 ANDEQ R0,R0,R0 0x00000038 0000004C ANDEQ R0,R0,R12,ASR #32 0x0000003C 00000050 ANDEQ R0,R0,R0,ASR R0 0x00000040 EAFFFFFE B 0x00000040 0x00000044 EAFFFFFE B 0x00000044 0x00000048 EAFFFFFE B 0x00000048 0x0000004C EAFFFFFE B 0x0000004C 0x00000050 EAFFFFFE B 0x00000050
Does anyone know what is going on???
The scatter file is defined as:
LR_IROM1 0x00003000 0x00080000 { ; load region size_region ER_IROM1 0x00003000 0x00080000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x40000040 0x00010000 { ; RW data .ANY (+RW +ZI) } RW_IRAM2 0x7FE00000 0x00004000 { .ANY (+RW +ZI) } RW_IRAM3 0x7FD00000 0x00004000 { .ANY (+RW +ZI) } }
Regards André
Hello again,
When I declare safe_buffer[0x68B4] a data abort exception happens at address 0x00003220
__scatterload_zeroinit: 0x0000320C E3B03000 MOVS R3,#rtc_tsk_usage(0x00000000) 0x00003210 E3B04000 MOVS R4,#rtc_tsk_usage(0x00000000) 0x00003214 E3B05000 MOVS R5,#rtc_tsk_usage(0x00000000) 0x00003218 E3B06000 MOVS R6,#rtc_tsk_usage(0x00000000) 0x0000321C E2522010 SUBS R2,R2,#0x00000010 ->0x00003220 28A10078 STMCSIA R1!,{R3-R6} 0x00003224 8AFFFFFC BHI 0x0000321C 0x00003228 E1B02E82 MOVS R2,R2,LSL #29 0x0000322C 28A10030 STMCSIA R1!,{R4-R5} 0x00003230 45813000 STRMI R3,[R1] 0x00003234 E12FFF1E BX R14
Does anyone know how to fix it?
Regards Andre
I have noticed that R1 = 0x40010010 is higher than the maxim valid address for the 64K area : 0x40000000. This maybe the cause of the data abort.
Hello all again! I have found the problem.
The scatter file was wrong. Line RW_IRAM1 0x40000040 0x10000 was replaced with RW_IRAM1 0x40000040 0xFFC0
Cheers, Andre