Home arrow Support arrow Forums

Luminary Micro Forums

ChristopherNeufelt

Senior Boarder

2008/10/29 05:11

Simple assembly programming error

Hello

The topic that I raise has to deal with assembly programming, in particular writing everything with assembler and flashing to a development board. In my case the LM3S1968 (I call it flower power for obvious reasons;)
The environment that I have is Keil Uvision3 and I use the DOS assembler located in bin31.

The code, property of J.Yiu is:

StackTop EQU 0x20002000 ; constant for SP starting value
AREA Program, CODE, READONLY ; declare area for code
DCD StackTop ; Stack top
DCD START ; Reset vector
ENTRY

START MOV R0, #10 ; Starting loop counter value
MOV R1, #0 ; starting result
; Calculated 10+9+8+...+1
LOOP ADD R1, R0 ; R1 = R1 + R0
SUBS R0, #1 ; Decrement R0, update flag (“S” suffi x)
BNE LOOP ; If result not zero jump to loop
; Result is now in R1
HERE BAL HERE ; Infinite loop
END


Let the assembler directive in command prompt (DOS) to be:
C:armasm --li --device=DLM -g --list CN1.list CN1.s
and the linker to be:
C:armlink --device=DLM --rw_base 0x20000000 --ro_base 0x0 --entry 0x0 -o CN1.elf CN1.o

Now the beautiful error message: L6236E: No section matches selector -no section to be First/Last.

What all this means? According to "ADS error and warnings" I should add the --entry 0x0 in order to indicate the start of my program which I suppose I did. Any suggestions?

Sincerely
Chris

login or register to reply

tim124

Expert Boarder

2008/10/29 07:37

Re:Simple assembly programming error

if you look at:

http://www.keil.com/forum/docs/thread13259.asp

it also says you need to add:

Code:

  AREA subroutCODEREADONLY ENTRY <span style="color: #FF0000">ENTRY;</span> ...

login or register to reply

cb1

Platinum Boarder

2008/10/29 07:40

Re:Simple assembly programming error

Hi Chris,

Curious why you seek to write everything in Assembler. Is it so that you use free version of IDE - without code-size limitation?

login or register to reply

ChristopherNeufelt

Senior Boarder

2008/10/29 07:59

Re:Simple assembly programming error

Hallo
At Tim124:
I am aware of this thread. It did not work on my code, not even at a complete copy of the code provided.

At cb1:
There is a reason of writing to assembler: understanding preciselly the way the controller works because I evaluate it for safety critical applications: in addition, I have already wrote code in C that needs debugging with the disassembler. To understand some parts of the assembler you need assembler.
The environment that I use are not unlimited:
Keil uVision3 has 32k evaluation capability.
Code Red has expired its date, but in any case was a mess to use.

Love, Happiness and Peace to everybody

Chris

login or register to reply

joseph_yiu

Expert Boarder

2008/10/31 07:01

Re:Simple assembly programming error

Hi there,
Try separating the vector and the program code into two sections:

Code:

  StackTop EQU 0x20002000 constant for SP starting value     AREA RESETDATAREADONLY ; declare area for code     EXPORT  __VECTORS __VECTORS     DCD StackTop Stack top     DCD START Reset vector     AREA ProgramCODEREADONLY ; declare area for code     ENTRY     EXPORT  START START      MOV R0#10 ; Starting loop counter value     MOV R1#0 ; starting result     Calculated 10+9+8+...+1 LOOP      ADD R1R0 R1 R1 R0     SUBS R0#1 ; Decrement R0, update flag (“S” suffi x)     BNE LOOP ; If result not zero jump to loop     Result is now in R1 HERE      BAL HERE Infinite loop     END



And no need to use --entry as the entry point is already indicated in the code. But you need to add --first in linker option:

armasm --li --device=DLM -g --list CN1.list CN1.s

armlink --device=DLM --rw_base 0x20000000 --ro_base 0x0 --first __VECTORS -o CN1.elf CN1.o

login or register to reply

ChristopherNeufelt

Senior Boarder

2008/10/31 07:36

Re:Simple assembly programming error

Hello Mr. Yiu
A great thanks for the personal touch to your code.
The main problem that most of us facing currently are mostly the complexity of the tools accompanied by the complexity of our subjects: These add two uncertainties to our endevour which add up to the development of the software.
I will consider this thread closed- Thanks everyone for your input

Chris

login or register to reply