Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
control is not returning to assembly when tried return(0) in main of test case
Jump...
Cancel
Locked
Locked
Replies
3 replies
Subscribers
119 subscribers
Views
4756 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
control is not returning to assembly when tried return(0) in main of test case
Lokesh Kumar
over 12 years ago
Note: This was originally posted on 27th August 2012 at
http://forums.arm.com
Hi,
Here is my code. As you can see below from C test case main has return and main was called by assembly code by using BL main.
But when I run this test control never comes back to assembly, since main is not retuning control to assembly as it should have done since BL instruction is used.
I do see that main function is getting completed as it's printing it's messages.
Do I need to do something different?
[color=#1F497D]Assembly code is as below :-[/color]
//ARM initialization code
//Call C main function
BL main
MOV r0, #0
MOV r1, #1
LDR r2, =0xffffffff
LDR r10, =0xcab00010
LDR r0, [r10]
STR r0, [r10] ; 0's
STR r2, [r10] ; f's
STR r0, [r10] ; 0's
DMB
Loop
WFI
B Loop
B pass
[color=#1F497D] [/color]
[color=#1F497D][/color]Main function of C code is as below :-
[color=#1F497D] [/color]int main(int argc, char *argv[]) {
loc_puts("INFO: ARM Booted Successfully!\n");
loc_puts("READ to boot space!\n"); return (0);
}
Parents
Scott Douglass
over 12 years ago
Note: This was originally posted on 5th September 2012 at
http://forums.arm.com
The stack pointer (and indirectly the stack size) is usually set by the "startup code". For bare-metal (no OS) cases this can be code supplied by the development environment. The startup code and is also responsible for things like iniitializing global variables, initializing the C library and calling main. You seem to be writing your own startup code and using the ARM compiler (Keil, DS-5 or RVDS). Have you seen this
http://infocenter.ar...h/CHDJGDAD.html
(or the equivalent for your version of the tools)? __main is the ARM library's startup code and is what make use of the ARM_LIB_STACK and ARM_LIB_HEAP areas.
The addresses of RAM suitable for use as stack and heap will depend on exactly what target you are using and will be different from one chip/platform to another.
Cancel
Vote up
0
Vote down
Cancel
Reply
Scott Douglass
over 12 years ago
Note: This was originally posted on 5th September 2012 at
http://forums.arm.com
The stack pointer (and indirectly the stack size) is usually set by the "startup code". For bare-metal (no OS) cases this can be code supplied by the development environment. The startup code and is also responsible for things like iniitializing global variables, initializing the C library and calling main. You seem to be writing your own startup code and using the ARM compiler (Keil, DS-5 or RVDS). Have you seen this
http://infocenter.ar...h/CHDJGDAD.html
(or the equivalent for your version of the tools)? __main is the ARM library's startup code and is what make use of the ARM_LIB_STACK and ARM_LIB_HEAP areas.
The addresses of RAM suitable for use as stack and heap will depend on exactly what target you are using and will be different from one chip/platform to another.
Cancel
Vote up
0
Vote down
Cancel
Children
No data