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
  • 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
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic build flags that work in platform IO (Read 2201 times)
benyboy
Junior Member
**
Offline


Posts: 13
Joined: Aug 4th, 2022
build flags that work in platform IO
Aug 5th, 2022 at 12:29am
Print Post  
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 ? 


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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build flags that work in platform IO
Reply #1 - Aug 5th, 2022 at 12:37am
Print Post  
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.
« Last Edit: Aug 5th, 2022 at 12:38am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
benyboy
Junior Member
**
Offline


Posts: 13
Joined: Aug 4th, 2022
Re: build flags that work in platform IO
Reply #2 - Aug 6th, 2022 at 2:42pm
Print Post  
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
Select All
ED_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.
« Last Edit: Aug 7th, 2022 at 2:04pm by Tim@Visual Micro »  

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


Posts: 13
Joined: Aug 4th, 2022
Re: build flags that work in platform IO
Reply #3 - Aug 7th, 2022 at 10:37am
Print Post  
Ah sorry they are in the log and the -D switches have been added by visual micro.
Code
Select All
-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.
« Last Edit: Aug 7th, 2022 at 2:08pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build flags that work in platform IO
Reply #4 - Aug 7th, 2022 at 1:51pm
Print Post  
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
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint