project : QQ2440 arm broad
instuction: ADS1.2 project migrate to keil for arm project (RV3.1)
(1) copy source code from ADS1.2 project to keil project.
ADS1.2 project list:
2440test
|
|-- inc/*
|-- src/*
|-- 2440test.mcp
|-- others
keil project list:
2440test_keil
|-- inc/*
|-- src/*
|-- 2440test_keil.Uv2
|-- others
(2) liner error:
---------------------------------------------------------------------------------------------------------------------------------
test_keil.axf: Error: L6238E: 2440init.o(Init) contains invalid call from '~PRES8' function to 'REQ8' function Main.
---------------------------------------------------------------------------------------------------------------------------------
resovle method: (forward from )
---------------------------------------------------------------------------------------------------------------------------------
Solutions
There are two possible approaches to dealing with this issue:
1) If you have access to all your source code and are allowed to rebuild it
In this case you should rebuild all your objects/libraries using the latest version of the compilation tools.
Note that if you have any assembler files, you will need to:
i) check that all instructions preserve 8-byte stack alignment, and if necessary, correct them.
e.g. change:
STMFD sp!, {r0-r3, lr} ; push an odd number of registers
to:
STMFD sp!, {r0-r3, r12, lr} ; push an even number of registers
and:
ii) add the PRESERVE8 directive to the top of each assembler file.
e.g. change:
AREA Init, CODE, READONLY
to:
PRESERVE8
AREA Init, CODE, READONLY
(the PRES8 attribute applies to the whole object, not just the code section).
2) If you cannot rebuild all of your source code
If you have any legacy objects/libraries that cannot be rebuilt, either because you do not have the source code,
or because the old objects must not be rebuilt (e.g. for qualification/certification reasons), then you must inspect
the legacy objects to check whether they preserve 8-byte alignment or not. Use "fromelf -c" to disassemble the object code.
C/C++ code compiled with ADS 1.1 or later will normally preserve 8-byte alignment, but assembled code will not.
If your objects do indeed preserve 8-byte alignment, then the linker error L6238E can be suppressed with the use
of "--diag_suppress 6238" on the linker command line. By using this, you are effectively saying "I guarantee that
these objects are PRES8". The linker warning L6306W is suppressible with "--diag_suppress 6306".
If you are linking with legacy objects/libraries then you should also read the information on the option "--apcs /adsabi"
in the FAQ entry "Are legacy ADS objects/libraries compatible with RVCT 2.0 ?".
---------------------------------------------------------------------------------------------------------------------------------
(3) project setting for keil
(3.1) Choose the linker page.
(3.2) Disable the item: Use the memory layout from the target dialog.
(3.3) use scatter file for linker, and its content as following:
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_ROM1 0x00000000 { ; load region size_region
RO +0 { ; load address = execution address
2440init.o (+RO,+First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW +0x30000000 { ; RW data
.ANY (+RW)
}
ZI +0 { ; ZI data
.ANY (+ZI)
}
}
(Note: If you are using a scatter-loading description file, the output section symbols in Table 1.0 are undefined
so use exec_section_name can genrate synbol like Image$$RO$$Base by liker.)
Table 1.0
---------------------------------------------------------------------------------------------------------------------------------
Symbol Section type Description
---------------------------------------------------------------------------------------------------------------------------------
Image$$RO$$Base Output Address of the start of the RO output section.
Image$$RO$$Limit Output Address of the first byte beyond the end of the RO output section.
Image$$RW$$Base Output Address of the start of the RW output section.
Image$$RW$$Limit Output Address of the byte beyond the end of the ZI output section.
(The choice of the end of the ZI region rather than the end of the RW region is to maintain compatibility with legacy code.)
Image$$ZI$$Base Output Address of the start of the ZI output section.
Image$$ZI$$Limit Output Address of the byte beyond the end of the ZI output section
----------------------------------------------------------------------------------------------------------------------------------
(3.4) you can get the linker option from the "linker control string" district as below:
----------------------------------------------------------------------------------------------------------------------------------
liker option:
----------------------------------------------------------------------------------------------------------------------------------
--autoat --summary_stderr --info summarysizes --map --xref --callgraph --symbols --info sizes
--info totals --info unused --info veneers --list ".\test_keil.map" -o "2440test_keil.axf"
----------------------------------------------------------------------------------------------------------------------------------
(4) download the "2440test_keil.hex" to broad by H-Flasher.
阅读(1552) | 评论(0) | 转发(0) |