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

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
  • Note: This was originally posted on 4th September 2012 at http://forums.arm.com

    Scott,

    Thanks for answering.
    How to set stack size so that main function doesn't overwrite return address?
    Is there any way to avoid it?

    I see in assembly we do give option like below

       ; Heap starts at 1MB in RAM and grows upwards
      ARM_LIB_HEAP 0x20100000 EMPTY 0x100000-0x8000
      {
      }

      ;; Stack starts at the end of the 2MB of RAM
      ;; And grows downwards for 32KB
      ARM_LIB_STACK 0x20200000 EMPTY -0x8000
      {
      }

    Is this the correct or I need to modify them?

    Please guide me, as I am knew to arm flow.

    Thanks
Reply
  • Note: This was originally posted on 4th September 2012 at http://forums.arm.com

    Scott,

    Thanks for answering.
    How to set stack size so that main function doesn't overwrite return address?
    Is there any way to avoid it?

    I see in assembly we do give option like below

       ; Heap starts at 1MB in RAM and grows upwards
      ARM_LIB_HEAP 0x20100000 EMPTY 0x100000-0x8000
      {
      }

      ;; Stack starts at the end of the 2MB of RAM
      ;; And grows downwards for 32KB
      ARM_LIB_STACK 0x20200000 EMPTY -0x8000
      {
      }

    Is this the correct or I need to modify them?

    Please guide me, as I am knew to arm flow.

    Thanks
Children
No data