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

building a very simple assembly program.. killing me.

hello all,

I am trying to get my arm7tdmi.. better yet an at91sam7x256 processor to do the simplist of assembly programs.. I have the program done and it should be flawless..

write the sum of cubes from 1 to 10 to a register..

AREA cubesum, CODE, AT 0x00000000
PUBLIC ?ASM?INIT

?ASM?INIT

begin: MOV R0, #0 MOV R1, #1
next: MUL R2, R1, R1

MLA R0, R2, R1, R0

ADD R1, R1, #1

CMP R1, #0xb

BNE next
END

anyway I keep getting these errors when I compile..

FirstProgram.asm(1): error: A1163E: Unknown opcode cubesum, , expecting opcode or Macro

FirstProgram.asm(2): error: A1355U: A Label was found which was in no AREA

I don't understand. shouldnt cubesum be the program name at the top? and dont you need to declare the asminit so it knows it's using assembly? This is really iritating me considering my text book doesn't explain startup files at all and has no useful information on what headers I need, and also that there is no decent support on the web (like no one has run into this before). help would be much appreciated. once I have it initialized coding is the easy part. oh and I'm using the stock startup file for that specific processor.

thanks all,

justin

Parents
  • "I am trying to [...] do the simplist of assembly programs.. I have the program done and it should be flawless"

    Only if you supply correct syntax.

    1) Assemblers are VERY sensitive to formatting. A directive such as AREA needs whitespace (space or TABs) preceding it. NEVER start a assembler line at column 0;

    2) The AREA directive (RVCT 3.x) does not have a section attribute AT, and even if it had, code should not be located at absolute position 0x00000000, since this is the address of the default interrupt vectors table. You should load the PC with your routine address at 0x00000000;

    "and dont you need to declare the asminit so it knows it's using assembly"

    "?ASM?INIT" has no special meaning whatsoever to the assembler. You could just called your entry point "SUPERCALIFRAGILISTICEXPIALIDOCIOUS". The way the assembler knows you are 'using assembly' is a correct line syntax, with proper column spacing, and proper assembler directives.

    Read the MANUAL Real View Compilation Tools Assembler Guide, especially section 2.3 and section 7.8.2

Reply
  • "I am trying to [...] do the simplist of assembly programs.. I have the program done and it should be flawless"

    Only if you supply correct syntax.

    1) Assemblers are VERY sensitive to formatting. A directive such as AREA needs whitespace (space or TABs) preceding it. NEVER start a assembler line at column 0;

    2) The AREA directive (RVCT 3.x) does not have a section attribute AT, and even if it had, code should not be located at absolute position 0x00000000, since this is the address of the default interrupt vectors table. You should load the PC with your routine address at 0x00000000;

    "and dont you need to declare the asminit so it knows it's using assembly"

    "?ASM?INIT" has no special meaning whatsoever to the assembler. You could just called your entry point "SUPERCALIFRAGILISTICEXPIALIDOCIOUS". The way the assembler knows you are 'using assembly' is a correct line syntax, with proper column spacing, and proper assembler directives.

    Read the MANUAL Real View Compilation Tools Assembler Guide, especially section 2.3 and section 7.8.2

Children