Error concerning non-absolute arguments

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error concerning non-absolute arguments

Jump to solution
2,177 Views
jackabo
Contributor I
I had written a post before about getting an error when i used non-absolute arguments in certain instructions in my CW 5.1 for my MC9RS08KA2. However, I realized that I wasn't understanding what the error was saying. In the variable declaration section I have some variables that I declare by using "ds.b" For example,
 
SensorReading: ds.b 1
 
From what I understand, this clears one byte of space for this variable. However, when I then use this variable in an instruction such as "clr SensorReading", the compiler gives me and error and says that I can not do this with the -FA1 or -FA2 option. My question is if there is any way around this. Can I just say "SensorReading equ $00" and this would be the same? Thanks.
 
Jackabo
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
944 Views
CompilerGuru
NXP Employee
NXP Employee
Thanks bigmag, the $ was wrong, and there has to be at least a space or tab before every line except the labels.

Anyway my initial post was not that precise.
The point is that there has to be a ORG directive before every memory usage, and ds counts as such.

SO to reply to the original post, (I guess) the error was because the SensorReading label was in a relocatable area, and the reason why it was relocatable was the missing ORG before.

This derines SensorReading to be 0.
SensorReading EQU $00


 ORG $0
SensorReading: DS 1


With the ORG, SensorReading has the same value as when using the EQU, but in addition this also reserves/allocates one byte.

Daniel

View solution in original post

0 Kudos
Reply
3 Replies
944 Views
CompilerGuru
NXP Employee
NXP Employee
In Absolute assembly mode (say with -FA1 or -FA2), its up to the user to define any address, nothing can be defined in the linker (simply because it is not called :smileyhappy:.
The point I want to make is that in order to reserve one byte with ds (or ds.b), you have to define the current absolute address first. Usually it looks like this (with better names and more reasonable content, I hope):


my_ram: EQU $1234 ; adapt :smileywink:
my_flash: EQU $8234 ; adapt :smileywink:
ORG $my_ram
Var0: DS 4 ; Var0 occupies 4 bytes
Var1: DS 1
....
ORG my_flash
StartHere:
CLR Var1
....

ORG $FFFE
DC.W StartHere

Daniel

PS: Have a look at a wizard generated, absolute assembly project. As starting point its better and more reasonable that my out of memory snippet :smileywink:
0 Kudos
Reply
944 Views
bigmac
Specialist III
Hello Daniel,
 
In the line -
ORG $my_ram
 
why the '$' symbol?  I am not familiar with this variation.
 
Also, it appears indentation has been lost when posting the code snippet.  It is my understanding that a pseudo-op (or instruction) cannot commence at the first position on the line.
 
Regards,
Mac
 
0 Kudos
Reply
945 Views
CompilerGuru
NXP Employee
NXP Employee
Thanks bigmag, the $ was wrong, and there has to be at least a space or tab before every line except the labels.

Anyway my initial post was not that precise.
The point is that there has to be a ORG directive before every memory usage, and ds counts as such.

SO to reply to the original post, (I guess) the error was because the SensorReading label was in a relocatable area, and the reason why it was relocatable was the missing ORG before.

This derines SensorReading to be 0.
SensorReading EQU $00


 ORG $0
SensorReading: DS 1


With the ORG, SensorReading has the same value as when using the EQU, but in addition this also reserves/allocates one byte.

Daniel
0 Kudos
Reply