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

problem with assembler

AREA bob, CODE
b main
org 0
main
nop
nop
nop
nop
nop
loop:
b loop
END

with this code I get the following message
*** ERROR L138: CODE GENERATION: PROBLEM WHEN PROCESSING INSTRUCTIONS
CAUSE: ORG: offset below current offset

How do I fix this?

  • [You forgot to select a Toolset -- this looks like ARM, so that's what I selected...]

    The following is an educated guess, made without actually knowing ARM assembly language: This snippet tries to write two opcodes to address zero: the "b main" ends up there because its outside any relocatable segment, and then you're trying to write other code to it, following the 'org 0'. It's only natural that the tools don't think of that as a good idea.

    ORG should, generally, only appear at the start of a segment, and it may only position forward, not backward, inside the same segment.

  • AREA bob_test, CODE

    main:
    nop
    nop
    nop
    nop
    nop
    loop:
    b loop
    END

    I got rid of the brnach instruction but this code is offset to address 10. How do I change the offset to 0.

  • What is actually your problem. Do you want to create a STARTUP file for the device. Please take a look to the folder Keil\ARM\Startup. There we have several startup files.

    Reinhard