Sysprogs forums › Forums › VisualGDB › ASM file in VisualGDB project
- This topic has 8 replies, 3 voices, and was last updated 9 years, 9 months ago by sasha.
-
AuthorPosts
-
March 1, 2015 at 11:50 #6177sashaParticipant
Hi,
I am evaluating VisualGDB by porting my existing EWARM project.
My EWARM project includes one ASM file. I included the file into VisualGDB project; however, the compiler simply ignores it. In the ASM file properties, I see Does not participate in build. I tried changing it to C/C++ Compiler; however, the result was the same.
Any suggestion will be appreciated.
March 2, 2015 at 05:01 #6181supportKeymasterHi,
Please change the file extension to .S.
Note that the EWARM assembler syntax is different from the GNU ARM assembler syntax so you would need to change some directives. You can run the GCC with the -S flag to compile a .c/.cpp file into an assembly file to see a working example of an assembly file for your architecture.
March 2, 2015 at 06:17 #6196sashaParticipantThank you for quick answer.
I will try your directions.
March 5, 2015 at 12:07 #6214sashaParticipantHi,
Finally, I was able to try the suggestion. First of all, changing file extension to .s works, the compilers recognizes it and tries to compile.
However, I run into further problem. After I corrected assembler syntax to what required in GCC, the compiler still reports errors on lines like ldr sp,[r0] or push {r4-r11,lr}. The commands are legal in STM32F407 that I use; however, the compiler obviously applies restrictions of the initial THUMB. In the GDB properties I selected correct target processor. So, my question is: is it a way to instruct the compiler about correct instruction set?
Additional question: I cannot find where to specify recommended -S option. Will you provide more directions?
March 5, 2015 at 12:35 #6215swineoneParticipantI found the following directives at the beginning of an STM32F4xx startup file in assembly. Perhaps adding those to the beginning of your file should fix the problem. And yes, it does say cortex-m3 despite the fact that this is a Cortex-M4 CPU; no idea if you can change it to cortex-m4.
.syntax unified
.cpu cortex-m3
.fpu softvfp
.thumb
March 5, 2015 at 16:50 #6217sashaParticipantA lot of thanks, including .cpu cortex-m3 actually solved the problem. Likely, M3 and M4 are not that different.
However, I have further request: how to supply custom .lds file to the linker? Simply including .lds file to the project does not work; the file seems to be ignored.
March 5, 2015 at 17:07 #6218swineoneParticipantIf you mean a linker script file, at least if you’re using a standalone project (i.e. if you followed this tutorial) then it should be in Project -> VisualGDB Project Properties -> Embedded Project, under “Building and Linking”, “Linker script”. However, if it’s a conventional project, then I have no idea how.
March 10, 2015 at 01:07 #6224supportKeymasterFor a normal (non-standalone project) you can override the linker script by editing the <mcu>.mak file manually (-T argument in LDFLAGS). Note that it will be overridden next time your change your CPU type. To avoid that convert the project to a stand-alone one.
March 11, 2015 at 07:48 #6237sashaParticipantThank you very much, it seems working.
-
AuthorPosts
- You must be logged in to reply to this topic.