Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
build flags that work in platform IO (Read 365 times)
benyboy
Junior Member
**
Offline



Posts: 13
build flags that work in platform IO
Aug 5th, 2022 at 1:29am
 
Hi,

I have a project that includes a library in Arduino ( Opus audio encoder ) on a teensy 4.1 project.

The library requires I set these build flags.
build_flags =
    -D USB_DUAL_SERIAL
     -D OPUS_BUILD
     -D FIXED_POINT
     -D OVERRIDE_OPUS_ALLOC
     -D OVERRIDE_OPUS_FREE
     -D VAR_ARRAYS
     -D HAVE_CONFIG_H
     -D OVERRIDE_OPUS_ALLOC_SCRATCH
     -D DISABLE_FLOAT_API
     -D OPUS_ARM_INLINE_EDSP
     -D EMBEDDED_ARM
     -D OPUS_ARM_ASM
     -D opus_alloc(x)=NULL
     -D opus_free(x)=NULL

I read somewhere I should add them to boards.txt that comes with the Arduino compiler so I don't have much hope I can get this working.

Does anyway know how I can pass these encoder flags to the Arduino compiler or if its at all possible ? Is this something I should ask on the Arduino forums or is it a Visual Micro question ?

I am sort of stuck between a rock and a hard place since I need a debugger to complete my project ( platform IO ) doesn't have one.. and  VM ( visual micro ) where I don't know how to set these library specific build flags.

Am I right in thinking platform IO uses GCC and Visual Micro compiles using the Arduino IDE ?


Back to top
« Last Edit: Aug 5th, 2022 at 1:30am by benyboy »  
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online



Posts: 11537
United Kingdom
Re: build flags that work in platform IO
Reply #1 - Aug 5th, 2022 at 1:37am
 
Visual Micro uses the Teensy tool chain to build. The Arduino IDE uses same. All tool chains for all boards use GCC.

If you follow the guide in yellow at the top of this page you will see the individual build commands.

First off please be aware that with Teensy for Arduino, you should look at the vMicro menu to see if there are built-in board options (Option1, Option2 etc) that automatically set some (or all) of the defines you need in the background. That's how the board options work for any Arduino packages that have them. The same built-in options also show on the menus of the Arduino IDE.

The board.txt is a bit overkill for this, it allows you to entirely override build statements. Visual Micro provides alternative simpler ways to add defines to the build process. The main documentation index on visualmicro.com has a link that shows how to specify defines. https://www.visualmicro.com/page/User-Guide.aspx?doc=Project-Defines.html

There are also a variety of compiler switches and overrides in the same project properties area as the link above shows.
Back to top
« Last Edit: Aug 5th, 2022 at 1:38am by Tim@Visual Micro »  

Tim Leek
home
WWW  
IP Logged
 
benyboy
Junior Member
**
Offline



Posts: 13
Re: build flags that work in platform IO
Reply #2 - Aug 6th, 2022 at 3:42pm
 
hi , switched on verbose build properties and attached a txt file.

I put these in the project properties page of visual micro in "Configuration Defines" entry

Code:
OPUS_BUILD;FIXED_POINT;OVERRIDE_OPUS_ALLOC;OVERRIDE_OPUS_FREE;VAR_ARRAYS;HAVE_CONFIG_H;OVERRIDE_OPUS_ALLOC_SCRATCH;DISABLE_FLOAT_API;OPUS_ARM_INLINE_EDSP;EMBEDDED_ARM;OPUS_ARM_ASM;opus_alloc(x)=NULL;opus_free(x)=NULL 



I don't see them come up in the build flags in the build properties. do I need to keep the -D switch in each entry ? do I have this wrong ?

does the -D switch just means define and I can just add these as #define xyz in a main.h header of the project as another way of doing the same thing ?

Thanks for you help with this.
Back to top
« Last Edit: Aug 7th, 2022 at 3:04pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
benyboy
Junior Member
**
Offline



Posts: 13
Re: build flags that work in platform IO
Reply #3 - Aug 7th, 2022 at 11:37am
 
Ah sorry they are in the log and the -D switches have been added by visual micro.
Code:
-Dopus_free(x)=NULL -Dopus_alloc(x)=NULL -DOPUS_ARM_ASM -DEMBEDDED_ARM -DOPUS_ARM_INLINE_EDSP -DDISABLE_FLOAT_API -DOVERRIDE_OPUS_ALLOC_SCRATCH -DHAVE_CONFIG_H -DVAR_ARRAYS -DOVERRIDE_OPUS_FREE -DOVERRIDE_OPUS_ALLOC -DFIXED_POINT -DOPUS_BUILD -I
 


the project also builds now. I'll report back if I get issues.

thanks again.
Back to top
« Last Edit: Aug 7th, 2022 at 3:08pm by Tim@Visual Micro »  
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online



Posts: 11537
United Kingdom
Re: build flags that work in platform IO
Reply #4 - Aug 7th, 2022 at 2:51pm
 
Great thanks for the update.

ps: You have the debug configuration enabled and you set config specific defines. When you switch to release they wont be applied. I suggest using the Global defines set in the same location.
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print