Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 18 of 18

Thread: Using the BME680 with IAQ with the Teensy 3.1/3.2

  1. #1
    Senior Member
    Join Date
    Apr 2013
    Posts
    162

    Using the BME680 with IAQ with the Teensy 3.1/3.2

    If you want to use the IAQ function, you need to add an precompiled file and change some of the file locations.

    1. Download the lib from github: Link
    2. Create an Folder basic_BME680 in your Sketchfolder "C:\-your path-\Documents\Arduino\"
    3. Copy some files to it.
    BSEC_BME680\examples\basic\basic.ino
    BSEC_BME680\src\*
    BSEC_BME680\src\bme680\bme*
    BSEC_BME680\src\inc\*
    BSEC_BME680\src\bsec.*
    BSEC_BME680\keywords.txt
    BSEC_BME680\src\cortex-m4 (the cortex-m4 folder with file, the Teensy 3.1/3.2 is an m4)

    4. Modify the bcec.h
    Change:
    #include "inc/bsec_datatypes.h"
    #include "inc/bsec_interface.h"
    #include "bme680/bme680.h"
    to:
    #include "bsec_datatypes.h"
    #include "bsec_interface.h"
    #include "bme680.h"

    5. Now the tricky part change the platform.txt from teensyduino (1.8.12 for example)
    Open arduino-1.8.12\hardware\teensy\avr\platform.txt
    Search for: ## Link

    Change:
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}

    to:
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "C:\-your path-\Documents\Arduino\basic_BME680\cortex-m4\libalgobsec.a" "-L{build.path}" {build.flags.libs}

    So after this you should run the BME680 with all features.

    Downside the precompiled is now part as long as it stayes inside the platform.txt and it needs to be done with every new Teensyduino version.

    Atm. I don't know an better way to get this done:
    When you add this to the platform.txt
    compiler.libraries.ldflags=

    And change the ## Link to this
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "{compiler.libraries.ldflags}" "-L{build.path}" {build.flags.libs}

    the compiler ask for the libalgobsec.a in the folder BSEC_BME680\src\mk20dx256 but even if I do him the favor it won't compile sucessfully. If someone has some hints to do that would be nice.

    Paul does not support to include precompiled from the lib itself at this point so far.

    File with the complete folder added with this version "Bosch Sensortec Environmental Cluster (BSEC) Software v1.4.7.4 released on July 3rd, 2019" and changed bcec.h
    Attached Files Attached Files
    Last edited by Markus_L811; 06-15-2020 at 01:30 PM. Reason: precompiled

  2. #2
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Quote Originally Posted by Markus_L811 View Post
    If you want to use the IAQ function, you need to add an precompiled file and change some of the file locations.

    1. Download the lib from github: Link
    2. Create an Folder basic_BME680 in your Sketchfolder "C:\-your path-\Documents\Arduino\"
    3. Copy some files to it.
    BSEC_BME680\examples\basic\basic.ino
    BSEC_BME680\src\*
    BSEC_BME680\src\bme680\bme*
    BSEC_BME680\src\inc\*
    BSEC_BME680\src\bsec.*
    BSEC_BME680\keywords.txt
    BSEC_BME680\src\cortex-m4 (the cortex-m4 folder with file, the Teensy 3.1/3.2 is an m4)

    4. Modify the bcec.h
    Change:
    #include "inc/bsec_datatypes.h"
    #include "inc/bsec_interface.h"
    #include "bme680/bme680.h"
    to:
    #include "bsec_datatypes.h"
    #include "bsec_interface.h"
    #include "bme680.h"

    5. Now the tricky part change the platform.txt from teensyduino (1.8.12 for example)
    Open arduino-1.8.12\hardware\teensy\avr\platform.txt
    Search for: ## Link

    Change:
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}

    to:
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "C:\-your path-\Documents\Arduino\basic_BME680\cortex-m4\libalgobsec.a" "-L{build.path}" {build.flags.libs}

    So after this you should run the BME680 with all features.

    Downside the precompiled is now part as long as it stayes inside the platform.txt and it needs to be done with every new Teensyduino version.

    Atm. I don't know an better way to get this done:
    When you add this to the platform.txt
    compiler.libraries.ldflags=

    And change the ## Link to this
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "{compiler.libraries.ldflags}" "-L{build.path}" {build.flags.libs}

    the compiler ask for the libalgobsec.a in the folder BSEC_BME680\src\mk20dx256 but even if I do him the favor it won't compile sucessfully. If someone has some hints to do that would be nice.

    Paul does not support to include precompiled from the lib itself at this point so far.

    File with the complete folder added with this version "Bosch Sensortec Environmental Cluster (BSEC) Software v1.4.7.4 released on July 3rd, 2019" and changed bcec.h

    Hello!!

    Im trying to compile but obviously im making an error as is not working.

    I followed your instructions but i have question as you first say to put the full path to lib file in "recipe.c.combine.pattern" var inside arduino-1.8.12\hardware\teensy\avr\platform.txt and later you mentioned to put the "{compiler.libraries.ldflags}" empty var......

    Im allways getting an error "undefined reference to" so i assume that lib is not linking ok

    Does it works for you¿

  3. #3
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Quote Originally Posted by natxo View Post
    Hello!!

    Im trying to compile but obviously im making an error as is not working.

    I followed your instructions but i have question as you first say to put the full path to lib file in "recipe.c.combine.pattern" var inside arduino-1.8.12\hardware\teensy\avr\platform.txt and later you mentioned to put the "{compiler.libraries.ldflags}" empty var......

    Im allways getting an error "undefined reference to" so i assume that lib is not linking ok

    Does it works for you¿
    You have to use this Line with you path

    Code:
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "C:\-your path-\Documents\Arduino\basic_BME680\cortex-m4\libalgobsec.a" "-L{build.path}" {build.flags.libs}
    The 2nd Line you used showes the actuall Arduino solution.

    Did you use an Teensy 3.1/3.2?

  4. #4
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Quote Originally Posted by Markus_L811 View Post
    You have to use this Line with you path

    Code:
    recipe.c.combine.pattern="{compiler.path}{build.to olchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "C:\-your path-\Documents\Arduino\basic_BME680\cortex-m4\libalgobsec.a" "-L{build.path}" {build.flags.libs}
    The 2nd Line you used showes the actuall Arduino solution.

    Did you use an Teensy 3.1/3.2?
    Thank you Markus!!

    I will use 3.2, i was confused because i think i will need to set the path with -L and later the name of the lib to link -lalgobsec ......

    I come from using a esp8266 (nodemcu) but i was having problems with a unstable serial communication, the boards sometimes stop sending data, and i was not using the wifi. So i move to use a teensy, in a few days teensy will arrive and see if i get a reliable communication. For sensor im using adafruit one

    Can i ask you what bsec library version are you using and if is working correctly?

  5. #5
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    The above mentioned Bosch Sensortec Environmental Cluster (BSEC) Software v1.4.7.4 the latest changed one parts for the latest Arduino 1.8.13, and yes it works well, I did not use it on continuous run, but it works for hours as I tested it.

    My intention was to get it work, on an Teensy not to use it

  6. #6
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    I tried to download the zip you linked to see the version but is a empy folder once i uncompress it.

    Is compiling ok!! now i need the board to upload and test it.

    Thank you!!

    NOTE: also works installing the library with the arduino library manager and puting the linker flag as you describe

  7. #7
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Quote Originally Posted by natxo View Post
    NOTE: also works installing the library with the arduino library manager and puting the linker flag as you describe
    That is new, didn't work in the first place as I tested it, sorry for the empty zip there is the filled, no idea why his was empty

    Get this with Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

    Library BSEC-Arduino-library-master has been declared precompiled:

    Precompiled library in "C:\Users\Markus\Documents\Arduino\libraries\B SEC-Arduino-library-master\src\mk20dx256" not found

    The plaform does not support 'compiler.libraries.ldflags' for precompiled libraries.

    arm-none-eabi-gcc: error: {compiler.libraries.ldflags}: No such file or directory

    Error compiling for board Teensy 3.2 / 3.1.
    And with the folder mk20dx256

    Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

    Library BSEC-Arduino-library-master has been declared precompiled:

    Using precompiled library in C:\Users\Markus\Documents\Arduino\libraries\BSEC-Arduino-library-master\src\mk20dx256

    The plaform does not support 'compiler.libraries.ldflags' for precompiled libraries.

    arm-none-eabi-gcc: error: {compiler.libraries.ldflags}: No such file or directory

    Error compiling for board Teensy 3.2 / 3.1.
    Did you change something else? From the Library Manager you will get the 1.4.703 from Github the 1.5.1474
    Attached Files Attached Files
    Last edited by Markus_L811; 10-14-2020 at 10:34 PM.

  8. #8
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Hello

    I installed the library using the libraray manager, not importing zip file.... arduino 1.8.13, teensyduino 1.53 on Ubuntu 20.04

    here is the output

    https://gist.github.com/natxopedreir...45f8940308ea3f

  9. #9
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Quote Originally Posted by natxo View Post
    Hello

    I installed the library using the libraray manager, not importing zip file.... arduino 1.8.13, teensyduino 1.53 on Ubuntu 20.04

    here is the output

    https://gist.github.com/natxopedreir...45f8940308ea3f
    Sorry no it doesn't work
    Code:
    Compiling library "BSEC_Software_Library"
    Library BSEC_Software_Library has been declared precompiled:
    Precompiled library in "/home/natxo/Arduino/libraries/BSEC_Software_Library/src/mk20dx256" not found
    The plaform does not support 'compiler.libraries.ldflags' for precompiled libraries.
    Is not included inside.

  10. #10
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Quote Originally Posted by Markus_L811 View Post
    Sorry no it doesn't work
    Code:
    Compiling library "BSEC_Software_Library"
    Library BSEC_Software_Library has been declared precompiled:
    Precompiled library in "/home/natxo/Arduino/libraries/BSEC_Software_Library/src/mk20dx256" not found
    The plaform does not support 'compiler.libraries.ldflags' for precompiled libraries.
    Is not included inside.
    Maybe thats a warning?, compilation does not stop and if library is not found in linking phase you should get some errors about using undefined methods that im calling in code.

    Anyway i will update on Monday as my hardware will arrive and i will test, if not work i know your method works as is tested for you

    Code:
    Linking everything together...
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-gcc -O2 -Wl,--gc-sections,--relax,--defsym=__rtc_localtime=1602756998 -T/home/natxo/arduino-1.8.13/hardware/teensy/avr/cores/teensy3/mk20dx256.ld -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -o /tmp/arduino_build_876421/basic.ino.elf /tmp/arduino_build_876421/sketch/basic.ino.cpp.o /tmp/arduino_build_876421/libraries/BSEC_Software_Library/bsec.cpp.o /tmp/arduino_build_876421/libraries/BSEC_Software_Library/bme680/bme680.c.o /tmp/arduino_build_876421/libraries/Wire/Wire.cpp.o /tmp/arduino_build_876421/libraries/Wire/WireIMXRT.cpp.o /tmp/arduino_build_876421/libraries/Wire/WireKinetis.cpp.o /tmp/arduino_build_876421/libraries/Wire/utility/twi.c.o /tmp/arduino_build_876421/libraries/SPI/SPI.cpp.o /tmp/arduino_build_876421/core/core.a /home/natxo/Arduino/lifesens_bme680_teensy/cortex-m4/libalgobsec.a -L/tmp/arduino_build_876421 -larm_cortexM4l_math -lm -lstdc++
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino_build_876421/basic.ino.elf /tmp/arduino_build_876421/basic.ino.eep
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -R .eeprom /tmp/arduino_build_876421/basic.ino.elf /tmp/arduino_build_876421/basic.ino.hex
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/stdout_redirect /tmp/arduino_build_876421/basic.ino.lst /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -d -S -C /tmp/arduino_build_876421/basic.ino.elf
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/stdout_redirect /tmp/arduino_build_876421/basic.ino.sym /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -t -C /tmp/arduino_build_876421/basic.ino.elf
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/teensy_post_compile -file=basic.ino -path=/tmp/arduino_build_876421 -tools=/home/natxo/arduino-1.8.13/hardware/teensy/../tools/ -board=TEENSY32
    Opening Teensy Loader...

  11. #11
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Quote Originally Posted by natxo View Post
    Maybe thats a warning?, compilation does not stop and if library is not found in linking phase you should get some errors about using undefined methods that im calling in code.

    Anyway i will update on Monday as my hardware will arrive and i will test, if not work i know your method works as is tested for you

    Code:
    Linking everything together...
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-gcc -O2 -Wl,--gc-sections,--relax,--defsym=__rtc_localtime=1602756998 -T/home/natxo/arduino-1.8.13/hardware/teensy/avr/cores/teensy3/mk20dx256.ld -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -o /tmp/arduino_build_876421/basic.ino.elf /tmp/arduino_build_876421/sketch/basic.ino.cpp.o /tmp/arduino_build_876421/libraries/BSEC_Software_Library/bsec.cpp.o /tmp/arduino_build_876421/libraries/BSEC_Software_Library/bme680/bme680.c.o /tmp/arduino_build_876421/libraries/Wire/Wire.cpp.o /tmp/arduino_build_876421/libraries/Wire/WireIMXRT.cpp.o /tmp/arduino_build_876421/libraries/Wire/WireKinetis.cpp.o /tmp/arduino_build_876421/libraries/Wire/utility/twi.c.o /tmp/arduino_build_876421/libraries/SPI/SPI.cpp.o /tmp/arduino_build_876421/core/core.a /home/natxo/Arduino/lifesens_bme680_teensy/cortex-m4/libalgobsec.a -L/tmp/arduino_build_876421 -larm_cortexM4l_math -lm -lstdc++
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino_build_876421/basic.ino.elf /tmp/arduino_build_876421/basic.ino.eep
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -R .eeprom /tmp/arduino_build_876421/basic.ino.elf /tmp/arduino_build_876421/basic.ino.hex
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/stdout_redirect /tmp/arduino_build_876421/basic.ino.lst /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -d -S -C /tmp/arduino_build_876421/basic.ino.elf
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/stdout_redirect /tmp/arduino_build_876421/basic.ino.sym /home/natxo/arduino-1.8.13/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -t -C /tmp/arduino_build_876421/basic.ino.elf
    /home/natxo/arduino-1.8.13/hardware/teensy/../tools/teensy_post_compile -file=basic.ino -path=/tmp/arduino_build_876421 -tools=/home/natxo/arduino-1.8.13/hardware/teensy/../tools/ -board=TEENSY32
    Opening Teensy Loader...
    Interesting it linked

    Code:
    /home/natxo/Arduino/lifesens_bme680_teensy/cortex-m4/libalgobsec.a
    but says it did not find

    Code:
    Precompiled library in "/home/natxo/Arduino/libraries/BSEC_Software_Library/src/mk20dx256" not found
    May someone can explain that

  12. #12
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Quote Originally Posted by Markus_L811 View Post
    Interesting it linked

    Code:
    /home/natxo/Arduino/lifesens_bme680_teensy/cortex-m4/libalgobsec.a
    but says it did not find

    Code:
    Precompiled library in "/home/natxo/Arduino/libraries/BSEC_Software_Library/src/mk20dx256" not found
    May someone can explain that

    IMO it says that not found what it expected, but as you later are setting the lib manually it links and compile

    I dont know how arduino make sytem works as it should work using a ldflag, setting the path with -L/home/natxo/Arduino/lifesens_bme680_teensy/cortex-m4 and later set the lib name -lalgobsec and when i tried it linked but get errors about the order on how libs link......

  13. #13
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Quote Originally Posted by Markus_L811 View Post
    Interesting it linked

    Code:
    /home/natxo/Arduino/lifesens_bme680_teensy/cortex-m4/libalgobsec.a
    but says it did not find

    Code:
    Precompiled library in "/home/natxo/Arduino/libraries/BSEC_Software_Library/src/mk20dx256" not found
    May someone can explain that
    I found a partial explain
    https://github.com/BoschSensortec/BS...ary.properties

    "precompiled=true" means that it use a precompile lib

    "ldflags=-lalgobsec" this set the name of the lib to link

    and the expected path is src/artuitecture/libraryfile.a

    so maybe putting the lib inside a architecture folder and set architectures architectures=cortex-m4

    So in teory modifying the library.properties of the installed lib should work, need to set the correct architecture


    Code:
    name=BSEC Software Library
    version=1.5.1474
    author=Bosch Sensortec
    maintainer=Bosch Sensortec <contact@bosch-sensortec.com>
    sentence=Bosch Sensortec Environmental Cluster (BSEC) Software library
    url=https://www.bosch-sensortec.com/software-tools/software/bsec/
    paragraph=  for use with the BME680 has been conceptualized to provide higher-level signal processing and fusion for the BME680. The library receives compensated sensor values from the sensor API. It processes the BME680 signals to provide the requested sensor outputs. 
    category=Sensors
    includes=bsec.h
    architectures=cortex-m4
    dot_a_linkage=true
    precompiled=true
    ldflags=-lalgobsec
    THat will make the compiler look for the lib in the correct folder, or thats my teory, sadly i can not test as i dont have my computer with me

    The compiler is getting the architecture of the teensy as mk20dx256 but the lib structure expected to be indentified as cortex-m4 and curiosly that architecture is not included in the original library.properties.... curious
    Last edited by natxo; 10-16-2020 at 09:46 PM.

  14. #14
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Quote Originally Posted by natxo View Post
    I found a partial explain
    https://github.com/BoschSensortec/BS...ary.properties

    "precompiled=true" means that it use a precompile lib

    "ldflags=-lalgobsec" this set the name of the lib to link

    and the expected path is src/artuitecture/libraryfile.a

    so maybe putting the lib inside a architecture folder and set architectures architectures=cortex-m4

    So in teory modifying the library.properties of the installed lib should work, need to set the correct architecture

    Code:
    name=BSEC Software Library
    version=1.5.1474
    author=Bosch Sensortec
    maintainer=Bosch Sensortec <contact@bosch-sensortec.com>
    sentence=Bosch Sensortec Environmental Cluster (BSEC) Software library
    url=https://www.bosch-sensortec.com/software-tools/software/bsec/
    paragraph=  for use with the BME680 has been conceptualized to provide higher-level signal processing and fusion for the BME680. The library receives compensated sensor values from the sensor API. It processes the BME680 signals to provide the requested sensor outputs. 
    category=Sensors
    includes=bsec.h
    architectures=cortex-m4
    dot_a_linkage=true
    precompiled=true
    ldflags=-lalgobsec
    THat will make the compiler look for the lib in the correct folder, or thats my teory, sadly i can not test as i dont have my computer with me

    The compiler is getting the architecture of the teensy as mk20dx256 but the lib structure expected to be indentified as cortex-m4 and curiosly that architecture is not included in the original library.properties.... curious
    Hello natxo,

    you are right if I change this Lines inside this files

    library.properties:
    Code:
    architectures=samd,sam,esp8266,nrf52,esp32,avr
    
    to
    
    architectures=*
    and inside the platform.txt
    Code:
    ## Link
    recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}
    
    ## Link
    compiler.libraries.ldflags=
    recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {compiler.libraries.ldflags} "-L{build.path}" {build.flags.libs}
    Without quotes, that does the trick.

    And add the src\cortex-m4 as copy with the name \src\mk20dx256.

    It does as you say.

    Code:
    Library BSEC-Arduino-library-master has been declared precompiled:
    Using precompiled library in C:\Users\Markus\Documents\Arduino\libraries\BSEC-Arduino-library-master\src\mk20dx256
    Sketch uses 73052 bytes (27%) of program storage space. Maximum is 262144 bytes.
    Global variables use 6524 bytes (9%) of dynamic memory, leaving 59012 bytes for local variables. Maximum is 65536 bytes.

  15. #15
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    Thank you Markus, good to know!!!!

    Anyway i will take a look when i have my computer and some time because this

    Code:
    ## Link
    compiler.libraries.ldflags=
    recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {compiler.libraries.ldflags} "-L{build.path}" {build.flags.libs}
    Is a bit nosese, library.properties files is defining the ldflag for the compiler to use "ldflags=-lalgobsec" and also you are defining a variable without any value "compiler.libraries.ldflags=" so i don't understand how that line is working.

    Good news is that if someone needs to use this lib here is defined how he can make it work

  16. #16
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Thank you,

    but there are 2 parts, the library.properties tells the IDE whats to do:

    dot_a_linkage=true
    precompiled=true
    ldflags=-lalgobsec

    So the IDE know there is an precompiled file named algobsec.a which is needed for the lib to work proper.

    The platfom.txt contains the procedur for the compiler to create an working .hex for the specific microcontroller e.g. Teensy 3.1/2

    compiler.libraries.ldflags=
    is an variable now filled with the path of the algobsec.a to link it inside the recipe.c.combine.pattern toolchain, so we need the variable placed on the right place inside the toolchain, but if you compile something that has no precompiled .a it has to stay empty so that it does not interfer with it, what is way better than my first line, what does nothing else than hardcode it in.

    But why it only works without quotes, I have no idea.

    Btw.

    architectures=* is now for all.

    Arduino differ per Core-Architectur (avr, cortex-m0 usw.), Paul with the Controller-Familie (mk20dx256).

    And the Teensy 3.1/2 is an cortex-m4 thats why we need this under an different name so the compiler can use the correct path with his variables.

  17. #17
    Junior Member
    Join Date
    Oct 2020
    Posts
    9
    I agree with you with one exception point that is the cause that make no sense to me.

    compiler.libraries.ldflags= Here is the declaration of a variable and set that var equal to.... no value, in wich line this var is getting the value of the ldflags, thats what is confusing me.


    I will say that if you put inside quotes is dealing as an string thats what do not work if you put the name of the var inside quotes

  18. #18
    Senior Member
    Join Date
    Apr 2013
    Posts
    162
    Quote Originally Posted by natxo View Post
    I agree with you with one exception point that is the cause that make no sense to me.

    compiler.libraries.ldflags= Here is the declaration of a variable and set that var equal to.... no value, in wich line this var is getting the value of the ldflags, thats what is confusing me.


    I will say that if you put inside quotes is dealing as an string thats what do not work if you put the name of the var inside quotes
    Good point, but it does not work without it.
    Code:
    Library BSEC-Arduino-library-master has been declared precompiled:
    Using precompiled library in C:\Users\Markus\Documents\Arduino\libraries\BSEC-Arduino-library-master\src\mk20dx256
    The plaform does not support 'compiler.libraries.ldflags' for precompiled libraries.
    arm-none-eabi-gcc: error: {compiler.libraries.ldflags}: No such file or directory
    Error compiling for board Teensy 3.2 / 3.1.
    Absend from the changes inside the platform.txt and the library.properties.

    I added some folders for the from Paul used Controllers and I can make it compile for all starting from the Teensy 3.0 to the Teensy 4.1 but not for the Teensy LC with 62k he is to small even for the reduced, lite Version of the algobsec.a (crashed on a littlebit of 316 bytes) added it, so may someone can use it.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •