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

How to make make MDK generate disassembly using "bx lr"?

The subroutine(C source code) is the same, but when compiled:

The DEMO's disassembly:

    PUSH {r4-r7}
    ...
    ...
    ...
    POP {r4-r7}
    BX  lr

My project's disassembly:

    PUSH {r4, lr}
    ...
    ...
    ...
    POP {r4, pc}

The situation is I clean all the RAM during the subroutine to 0. So after "POP {r4, pc}", the program is crashed.
I don't konw assembly language very well. So what could I do to make the ARMCC generate disassembly code using "BX lr" to make my code work?
I'm using STM32F103/MDK5/ARMCC5.06.

Parents
  • Thanks for your reply. (Robert McNamara, Westonsupermare Pier)

    @Robert McNamara
    Yes, my optimization level is 0 and these whole selftests(cpu/flash/ram/excute process) is before __main.

    @Westonsupermare Pier
    It's just 6 loops inside like below:

       /* ---------------------------- STEP 3 ----------------------------------- */
       /* Verify inverted background and write background with addresses increasing */
       for (p = RAM_START; p <= RAM_END; p += RAM_BLOCKSIZE)
       {
          for (j = 0u; j < RAM_BLOCKSIZE; j++)
          {
             if ( *(p + (uint32_t)RAM_SCRMBL[j]) != INV_BCKGRND)
             {
                Result = ERROR;
             }
             *(p + (uint32_t)RAM_SCRMBL[j]) = BCKGRND;
          }
       }
    


    I'm not familiar with the compilers/assemblers as well as ARM/Keil experts, so I couldn't find where to change to influence the complier/assembler's behavior.

    I won't digging this any more and the solution is I rewrite the RAM_selftest using assembly language. And it works, for now.
    About the 'Critical' stuff is actually iec60335 related which I don't understand very much but have to follow that.
    Thanks for all your help again.

Reply
  • Thanks for your reply. (Robert McNamara, Westonsupermare Pier)

    @Robert McNamara
    Yes, my optimization level is 0 and these whole selftests(cpu/flash/ram/excute process) is before __main.

    @Westonsupermare Pier
    It's just 6 loops inside like below:

       /* ---------------------------- STEP 3 ----------------------------------- */
       /* Verify inverted background and write background with addresses increasing */
       for (p = RAM_START; p <= RAM_END; p += RAM_BLOCKSIZE)
       {
          for (j = 0u; j < RAM_BLOCKSIZE; j++)
          {
             if ( *(p + (uint32_t)RAM_SCRMBL[j]) != INV_BCKGRND)
             {
                Result = ERROR;
             }
             *(p + (uint32_t)RAM_SCRMBL[j]) = BCKGRND;
          }
       }
    


    I'm not familiar with the compilers/assemblers as well as ARM/Keil experts, so I couldn't find where to change to influence the complier/assembler's behavior.

    I won't digging this any more and the solution is I rewrite the RAM_selftest using assembly language. And it works, for now.
    About the 'Critical' stuff is actually iec60335 related which I don't understand very much but have to follow that.
    Thanks for all your help again.

Children
No data