Assembler [INCLUDE] problem

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

Assembler [INCLUDE] problem

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Fri Mar 22 12:36:28 MST 2013
Hello,
I found an error with .include command.
I have files:
* main.s
* subrutine.s
In main I have => .include "../src/subrutine.s"

In subrutine I have => "lsrs r2,#24"
and I got error:
this command is not supported with Thumb16 mode.
On board is Cortex M0.
I can delete S in lsrs and it works (no error) but it should works like this :confused:
For me include command should works like copy paste.
0 Kudos
Reply
15 Replies

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Mon Apr 15 08:43:55 MST 2013

Quote: TheFallGuy
As you seem to be hard of thinking, let me try to explain again.

The IDE will call the assembler on EVERY file with a .s extension. So, if You include one .s file in another, it will be assembled twice. Once on its own, and once as part of the file it is included in.

By renaming the file to .src means that the IDe does not know it is an assembler file and therefore will not build it, meaning you don't get the error.

Take a look at the build log and you will see what I mean.

If you do not understand, I suggest you attend a programming class, where they can help you.



Thanks for hint but I am mechanical engineer.

Ok, I understand perfectly why I have no error with include as .inc but I don't understand how to deal with mulitply asm files by .include driective.
Anyway I can live without it ;)

Thanks guys for help !!!
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sun Apr 07 08:16:04 MST 2013

Quote: kisiel
I have already done this. I post whole project "test" here with two files. And as return I receive, you build two files... ok how to edit multiple files then?
Simple use external editor with syntax highlighter for files (.inc or .src) or put all files into one. This is not the USER problem, in LPCxpresso there is no solution for mulitply assembler files because no one mention it, yet :)



As you seem to be hard of thinking, let me try to explain again.

The IDE will call the assembler on EVERY file with a .s extension. So, if You include one .s file in another, it will be assembled twice. Once on its own, and once as part of the file it is included in.

By renaming the file to .src means that the IDe does not know it is an assembler file and therefore will not build it, meaning you don't get the error.

Take a look at the build log and you will see what I mean.

If you do not understand, I suggest you attend a programming class, where they can help you.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Sun Apr 07 05:19:31 MST 2013

Quote: kisiel
LPCxpresso there is no solution for mulitply assembler files because nob one mention it, yet :)


I gave the solution in the very first reply in this thread. It's a linking assembler so use it as a linking assembler. All this really means is that any entry point to functions that must be callable from another file should be . global and (optionally) should be .extern from the caller. It's hardly rocket science.

WF1903
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Sun Apr 07 04:11:02 MST 2013

Quote: TheFallGuy
It is patently a USER problem. You are making a mistake but are not listening to the advice we give you.

Why don't you post your project and then we can  fix it and return it to you.



I have already done this. I post whole project "test" here with two files. And as return I receive, you build two files... ok how to edit multiple files then?
Simple use external editor with syntax highlighter for files (.inc or .src) or put all files into one. This is not the USER problem, in LPCxpresso there is no solution for mulitply assembler files because no one mention it, yet :)
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sat Mar 30 02:14:00 MST 2013
It is patently a USER problem. You are making a mistake but are not listening to the advice we give you.

Why don't you post your project and then we can  fix it and return it to you.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cwpjr on Fri Mar 29 19:53:38 MST 2013
This seems to be patently foolish shot the  messenger crap. I gave up on includes working as they do in most every other c compiler or assembler because of these attitudes expressed here.

I was fortunate to have a mind that could conceive of workarounds even tho it is wrong.

Is this an eclipse issue? It was not a gnu issue I knew of in the past.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sun Mar 24 08:10:24 MST 2013
And that is exactly what it is doing. Your problem is that you are building main.s AND dummyassy.s.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Sun Mar 24 04:36:15 MST 2013

Quote: TheFallGuy
I think I see your mistake.

The .include is working, and is NOT causing an error, but as your file is called ".s" then that will also be built, and that is what is causing your problem. If you don't want to build it, you will have to Exclude it.



I want to bulid it as is in gnu assy :
"Insert the contents of filenameinto the current source file, [B]as if that file had been typed into the current file directly.[/B]"
So in LPCXpresso it's not working as it should work or it works perfectly accept .include directive ;)  I want only information whitch type of file I can use to EDIT included files without error (thumb16)  or how to highlights comments, directives in e.g. (.txt) or (.src).
Maybe some of external editor would be helpfull???
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sat Mar 23 09:36:32 MST 2013
I think I see your mistake.

The .include is working, and is NOT causing an error, but as your file is called ".s" then that will also be built, and that is what is causing your problem. If you don't want to build it, you will have to Exclude it.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Sat Mar 23 06:35:28 MST 2013

Quote: TheFallGuy
why don't you post a project that exhibits the problem, then we can probably help. It is very difficult to see your screen from here.



[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]@ Directives[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]
[/COLOR]

[/SIZE][SIZE=2].thumb                  [/SIZE]
[SIZE=2].thumb_func[/SIZE]
[SIZE=2].cpu cortex-m0[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055].align[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]    2[/SIZE]
[SIZE=2].syntax unified[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055].section[/COLOR][/SIZE][/COLOR][/SIZE][/B]





[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055].text[/COLOR][/SIZE][/COLOR][/SIZE][/B]

[SIZE=2]        .org 0[/SIZE]

[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]@ Vectors active interupt , from $00 to $c0[/COLOR][/SIZE][/COLOR][/SIZE]


[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]vectors:[/COLOR][/SIZE][/COLOR][/SIZE][/B]




[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055].word[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] STACKINIT         [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]@ stack pointer value when stack is empty[/COLOR][/SIZE][/COLOR][/SIZE]


[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055].word[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] _start + 1        [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]@ reset vector (manually adjust to odd for thumb) (0x04)[/COLOR][/SIZE][/COLOR][/SIZE]



[SIZE=2] [/SIZE]

[SIZE=2][COLOR=#7f0055][B][SIZE=2][COLOR=#7f0055]_start:[/COLOR][/SIZE][/B][/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]
[B][SIZE=2][COLOR=#7f0055]main:[/COLOR][/SIZE][/B]


[/COLOR]

[/SIZE]



[SIZE=2]    cpsid i[/SIZE]

[SIZE=2]     b main[/SIZE]



[SIZE=2][COLOR=#7f0055][B][SIZE=2][COLOR=#7f0055].include[/COLOR][/SIZE][/B][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"../src/dummyassy.s"[/COLOR][/SIZE][/COLOR][/SIZE]

[SIZE=2].end[/SIZE]

[SIZE=2]in included file is only one cmd[/SIZE]

[SIZE=2]lsrs r1,#24 [/SIZE]

[SIZE=2]Thats all. [/SIZE]
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Sat Mar 23 05:46:53 MST 2013
why don't you post a project that exhibits the problem, then we can probably help. It is very difficult to see your screen from here.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Sat Mar 23 02:36:21 MST 2013

Quote: cfb
It is not a problem related to include files - you get the same error message when you use inline assembler code in a C program. According to the following post you need to use the ".syntax unified" directive:

http://knowledgebase.nxp.com/showthread.php?t=336



Yep, I have already tried all directives not only .syntax unified. So its a problem of include directive. Why?
Because [B]I can assembly/build[COLOR=black] all files[/COLOR][/B] if I change file [COLOR=black]name[/COLOR] from xxx[B].s[/B] to e.g. xxxx[B].src[/B].
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cfb on Fri Mar 22 23:45:32 MST 2013
It is not a problem related to include files - you get the same error message when you use inline assembler code in a C program. According to the following post you need to use the ".syntax unified" directive:

http://knowledgebase.nxp.com/showthread.php?t=336
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kisiel on Fri Mar 22 16:31:10 MST 2013

Quote: wrighflyer
As it's a linking assembler why would you ever include one .s file in another?



Because I have 120KB+ of source code in one file and I want to split parts of code to included files and I am not useing C, only pure assembler.
As I found .include description in GNUassembler:
"Insert the contents of filenameinto the current source file, as if that file had been
typed into the current file directly."
In my situation I can edit/build/debug included file only if extension is [B]not[/B] recognised by LPCXpresso. So forget about clear highlighted source code in editor.
0 Kudos
Reply

952 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Fri Mar 22 15:51:26 MST 2013
As it's a linking assembler why would you ever include one .s file in another?
0 Kudos
Reply