Advanced Software Framework (ASF)?


#1

Hello,

Sorry for the noob question here.
I am using Arduino DUE in VScode , is it possible to run ASF3 drivers (i.e examples from the source code ) and Arduino Framework at the same time ?
How can I import let say the asf ‘dacc’ driver into an Arduino DUE project.

Does this question make any sens ?
Thanks a lot !


#2

It certainly makes sense to me, and would definitely appreciate knowing what the best way to make the LDF aware of multiple, nested “library” resources.

If you’re willing to use the Arduino framework and a few-year-old version of what Adafruit needed for their code, you might try #1849 Adafruit Arduino Zero ASF Core Library


Unfortunately, it is rather dated and doesn’t supply, for example i2c_master.h

The ASF is available for download from https://www.microchip.com/mplab/avr-support/avr-and-sam-downloads-archive (link valid as of November, 2018), but ends up with a deeply nested structure covering multiple devices.

In trying get platformio to use portions of the tree, I didn’t find symlinks to “bring up” the buried directories of interest to right under ./lib/ very reliable. I’ve been copying in the contents of each of the needed directories into ./lib/asf which is pretty ugly. So far, for i2c_master.h on an Adafruit ItsyBitsy M0, that includes

xdk-asf-3.43.0/common/utils
xdk-asf-3.43.0/sam0/utils                # Took these over common/utils/ versions
xdk-asf-3.43.0/sam0/drivers/i2c
xdk-asf-3.43.0/sam0/utils/preprocessor
xdk-asf-3.43.0/sam0/utils/header_files
xdk-asf-3.43.0/sam0/utils/cmsis/samd21/include
xdk-asf-3.43.0/sam0/utils/cmsis/samd21/source
xdk-asf-3.43.0/sam0/drivers/system
xdk-asf-3.43.0/sam0/drivers/gpio
xdk-asf-3.43.0/sam0/utils/cmsis/samb11/include/component  # overwriting gpio.h from above

Is there a good way to specify to platformio / LDF multiple, nested directories like this and their relative search order?

http://docs.platformio.org/en/latest/librarymanager/ldf.html#ldf wasn’t very clear, at least with my limited knowledge of platformio.


LDF seems to be “broken” – after several tries with lib_extra_dirs using comma-space separation as well as newline-plus-spaces, it fails to pick up compiler.h. However, simply placing a copy of that file into ./lib/hack/ and it is able to resolve all the headers without issue. It appears that lib_extra_dirs does not properly handle the second directory.

lib_ldf_mode = deep
lib_extra_dirs = /Users/jeff/Documents/devel/xdk-asf-3.43.0/sam0/drivers
    /Users/jeff/Documents/devel/xdk-asf-3.43.0/sam0/utils