VS Arduino
Visual Micro >> General Board >> build flags that work in platform IO
https://www.visualmicro.com/forums/YaBB.pl?num=1659659342

Message started by benyboy on Aug 5th, 2022 at 12:29am

Title: build flags that work in platform IO
Post by benyboy on Aug 5th, 2022 at 12: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 ?



Title: Re: build flags that work in platform IO
Post by Tim@Visual Micro on Aug 5th, 2022 at 12: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.

Title: Re: build flags that work in platform IO
Post by benyboy on Aug 6th, 2022 at 2: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[/code]

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.

https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=build_log_005.txt ( 781 KB | 3 Downloads )

Title: Re: build flags that work in platform IO
Post by benyboy on Aug 7th, 2022 at 10: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
[/code]
the project also builds now. I'll report back if I get issues.

thanks again.

Title: Re: build flags that work in platform IO
Post by Tim@Visual Micro on Aug 7th, 2022 at 1: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.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.