/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Very basic assembly program fails (Raid7 + Primer 2)

Username:     
Password:     
             

Forum

# 1   2010-12-11 00:39:34 Very basic assembly program fails (Raid7 + Primer 2)

oystein
New member
From: Norway
Registered: 2010-12-10
Posts: 2

Very basic assembly program fails (Raid7 + Primer 2)

Thank God there are forums. You see, I have found it very hard to locate examples of assembly programs for Cortex-M3 based MCUs, and I am very new to all of this myself.

I bought the Raisonance Primer 2 to have something to play with, to teach myself how to use the STM32F10 series. The Raisonance Ride 7 IDE is (as you know) bundled, and is what I use (I'm actually quite impressed so far). I understand the kit is based on the GNU toolchain.

So I try to build a very simple assembly program (this is literally my whole & only file, main.s):

Code:

main:
     movw   R0, #0     
     bx     LD          ; return 0

Which I understand is basically the equivalent of a C

Code:

int main (void)
{
    return 0;
}

But no, there were build errors, and later other errors.

#1: I'm not able to add comments. Any comments, anywhere. The assembler spits out an "invalid instruction" error every time. After a bit of digging on the GNU assembler, it might seem like the -f option is specified ("fast"), but I could not find it anywhere in the Raid 7 project/file options...?

#2: After removing any comments, I get a linker error, telling me that main is undefined. I'm clueless here, as it seems to be too basic for any ARM or ST documentation available to cover.

Any help is greatly appreciated. There is lots of documentation on the various instructions and registers and what not, but not on the file structure and such, it seems, so as a novice assembly programmer I feel kind of lost. Disassembling the C program above gave me an MASM listing, which did not help at all as it was not even close to a valid asm source file. The proper instructions were listed, though, but that does not really help in a case like this.

Offline

 

# 2   2010-12-12 21:56:14 Very basic assembly program fails (Raid7 + Primer 2)

oystein
New member
From: Norway
Registered: 2010-12-10
Posts: 2

Re: Very basic assembly program fails (Raid7 + Primer 2)

Problem solved - had to initialize stack pointer and set up the interrupt vector table properly, much like the startup_*.s files that come with the Primer 2 does.

Offline

 

Board footer