ASM file in VisualGDB project

Sysprogs forums Forums VisualGDB ASM file in VisualGDB project

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #6177
    sasha
    Participant

    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.

     

    #6181
    support
    Keymaster

    Hi,

    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.

    #6196
    sasha
    Participant

    Thank you for quick answer.

    I will try your directions.

    #6214
    sasha
    Participant

    Hi,

    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?  

    #6215
    swineone
    Participant

    I 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

    #6217
    sasha
    Participant

    A 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.

    #6218
    swineone
    Participant

    If 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.

    #6224
    support
    Keymaster

    For 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.

    #6237
    sasha
    Participant

    Thank you very much, it seems working.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.