warrenwoolseyiii / Arduino-SAMD20

Creating an arduino compatible library for the samd20 family of processors
2 stars 3 forks source link

sam.h: no such file or directory #7

Closed utsavZebra closed 3 years ago

utsavZebra commented 3 years ago

Id like to get this working in order to use the SAMD20G. Any insights to resolve this would be great

warrenwoolseyiii commented 3 years ago

Hey @utsavZebra sorry for the late reply I was out of the country on vacation.

I will be updating here shortly with the latest version which will probably fix this issue. I will test locally and get back to you

utsavZebra commented 3 years ago

No problem. Thanks @warrenwoolseyiii.

warrenwoolseyiii commented 3 years ago

okay - everything has been updated for the samd20e18 side of things so you should be able to build from there for that particular chip.

I haven't added support for the SAMD20G series yet but technically it should not be all that difficult. I think the G series has a handful of things that are different in terms of peripherals but for the most part the registers are all the same. If you would like to see support added just make a separate issue requesting support or you can make a branch and add it yourself!

utsavZebra commented 3 years ago

This problem still persists. Im using vs code on Windows subsystem for Linux Ubuntu 18.04

image

This is what my dl directory looks like

image

warrenwoolseyiii commented 3 years ago

can you post the full output as a text snippet?

utsavZebra commented 3 years ago
utsav-zebra@DESKTOP-5V448GU:/root/Arduino-SAMD20-develop$ make

(/bin/bash scripts/getpack.sh ""http://packs.download.atmel.com/"" "ARM" "CMSIS" "5.4.0" "/root/Arduino-SAMD20-develop/dl" || exit 1);
[INFO] Checking for device pack: ARM.CMSIS.5.4.0
[INFO] Downloading ARM.CMSIS.5.4.0.atpack from http://packs.download.atmel.com/
--2021-05-05 09:57:09--  http://packs.download.atmel.com/ARM.CMSIS.5.4.0.atpack
Resolving packs.download.atmel.com (packs.download.atmel.com)... 52.218.252.242
Connecting to packs.download.atmel.com (packs.download.atmel.com)|52.218.252.242|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15470366 (15M) [application/vnd.atmel.atpack]
Saving to: ‘/root/Arduino-SAMD20-develop/dl/ARM.CMSIS.5.4.0.atpack’

/root/Arduino-SAMD20-develop/dl/ARM.CMS 100%[============================================================================>]  14.75M  5.77MB/s    in 2.6s    

2021-05-05 09:57:12 (5.77 MB/s) - ‘/root/Arduino-SAMD20-develop/dl/ARM.CMSIS.5.4.0.atpack’ saved [15470366/15470366]

[INFO] Extracting ARM.CMSIS.5.4.0.atpack
scripts/getpack.sh: line 49: unzip: command not found
[OKAY] Successfully extracted ARM.CMSIS.5.4.0.atpack to /root/Arduino-SAMD20-develop/dl/devicepack/ARM/CMSIS/5.4.0
(/bin/bash scripts/getpack.sh ""http://packs.download.atmel.com/"" "Atmel" "SAMD20_DFP" "1.3.124" "/root/Arduino-SAMD20-develop/dl" || exit 1);
[INFO] Checking for device pack: Atmel.SAMD20_DFP.1.3.124
[INFO] Downloading Atmel.SAMD20_DFP.1.3.124.atpack from http://packs.download.atmel.com/
--2021-05-05 09:57:12--  http://packs.download.atmel.com/Atmel.SAMD20_DFP.1.3.124.atpack
Resolving packs.download.atmel.com (packs.download.atmel.com)... 52.218.252.242
Connecting to packs.download.atmel.com (packs.download.atmel.com)|52.218.252.242|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3162182 (3.0M) [application/vnd.atmel.atpack]
Saving to: ‘/root/Arduino-SAMD20-develop/dl/Atmel.SAMD20_DFP.1.3.124.atpack’

/root/Arduino-SAMD20-develop/dl/Atmel.S 100%[============================================================================>]   3.02M  2.23MB/s    in 1.4s    

2021-05-05 09:57:14 (2.23 MB/s) - ‘/root/Arduino-SAMD20-develop/dl/Atmel.SAMD20_DFP.1.3.124.atpack’ saved [3162182/3162182]

[INFO] Extracting Atmel.SAMD20_DFP.1.3.124.atpack
scripts/getpack.sh: line 49: unzip: command not found
[OKAY] Successfully extracted Atmel.SAMD20_DFP.1.3.124.atpack to /root/Arduino-SAMD20-develop/dl/devicepack/Atmel/SAMD20_DFP/1.3.124
USING TC_VER=9-2019-q4-major
(/bin/bash scripts/gettoolchain.sh "9-2019-q4-major" "linux" "/root/Arduino-SAMD20-develop/dl" || exit 1);
[INFO] Downloading gcc-arm-none-eabi-9-2019-q4-major-linux.tar.bz2 from https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2?revision=6e63531f-8cb1-40b9-bbfc-8a57cdfc01b4&la=en&hash=F761343D43A0587E8AC0925B723C04DBFB848339
--2021-05-05 09:57:14--  https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2?revision=6e63531f-8cb1-40b9-bbfc-8a57cdfc01b4&la=en&hash=F761343D43A0587E8AC0925B723C04DBFB848339
Resolving developer.arm.com (developer.arm.com)... 23.222.96.229
Connecting to developer.arm.com (developer.arm.com)|23.222.96.229|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 [following]
--2021-05-05 09:57:15--  https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
Resolving armkeil.blob.core.windows.net (armkeil.blob.core.windows.net)... 52.239.137.100
Connecting to armkeil.blob.core.windows.net (armkeil.blob.core.windows.net)|52.239.137.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 116802378 (111M) [application/octet-stream]
Saving to: ‘/root/Arduino-SAMD20-develop/dl/gcc-arm-none-eabi-9-2019-q4-major-linux.tar.bz2’

/root/Arduino-SAMD20-develop/dl/gcc-arm 100%[============================================================================>] 111.39M  4.15MB/s    in 29s     

2021-05-05 09:57:45 (3.88 MB/s) - ‘/root/Arduino-SAMD20-develop/dl/gcc-arm-none-eabi-9-2019-q4-major-linux.tar.bz2’ saved [116802378/116802378]

[OKAY] Extracted gcc-arm-none-eabi-9-2019-q4-major-linux to /root/Arduino-SAMD20-develop/dl/toolchains/9-2019-q4-major
(/bin/bash scripts/relink.sh "9-2019-q4-major" "/root/Arduino-SAMD20-develop/dl" || exit 1);
[OKAY] Toolchain 9-2019-q4-major linked to /root/Arduino-SAMD20-develop/toolchain
[OKAY] devicepack linked to /root/Arduino-SAMD20-develop/dl/devicepack
make clean -C arduino
make[1]: Entering directory '/root/Arduino-SAMD20-develop/arduino'
rm -rf build
make[1]: Leaving directory '/root/Arduino-SAMD20-develop/arduino'
make -C arduino
make[1]: Entering directory '/root/Arduino-SAMD20-develop/arduino'
mkdir -p build
Building file: /root/Arduino-SAMD20-develop/arduino/src/debug_hooks.c
Invoking: ARM/GNU C Compiler : 9.2.1
/root/Arduino-SAMD20-develop/toolchain/bin/arm-none-eabi-gcc  -mthumb -D__SAMD20E18__ -x c  -DDEBUG -DARDUINO_SAMD_E -DARDUINO_ARCH_SAMD -DSAMD20  -O3 -ffunction-sections -mlong-calls -g3 -Wall -std=gnu99  -I/root/Arduino-SAMD20-develop/devicepack/ARM/CMSIS/5.4.0/CMSIS/Core/Include -I/root/Arduino-SAMD20-develop/devicepack/Atmel/SAMD20_DFP/1.3.124/samd20/include -I/root/Arduino-SAMD20-develop/arduino/src -c  -mcpu=cortex-m0plus -MD -MP -MF build/debug_hooks.d -MTbuild/debug_hooks.d -MTbuild/debug_hooks.o -o build/debug_hooks.o /root/Arduino-SAMD20-develop/arduino/src/debug_hooks.c
In file included from /root/Arduino-SAMD20-develop/arduino/src/debug_hooks.c:18:
/root/Arduino-SAMD20-develop/arduino/src/debug_hooks.h:21:10: fatal error: sam.h: No such file or directory
   21 | #include "sam.h"
      |          ^~~~~~~
compilation terminated.
Makefile:86: recipe for target 'build/debug_hooks.o' failed
make[1]: *** [build/debug_hooks.o] Error 1
make[1]: Leaving directory '/root/Arduino-SAMD20-develop/arduino'
Makefile:42: recipe for target 'arduino' failed
make: *** [arduino] Error 2
utsav-zebra@DESKTOP-5V448GU:/root/Arduino-SAMD20-develop$ 
warrenwoolseyiii commented 3 years ago

What's your config.mk look like?

utsavZebra commented 3 years ago

I made no changes except creating the dl folder on my own

image

warrenwoolseyiii commented 3 years ago

okay check in this path to see if you have sam.h Arduino-SAMD20\dl\devicepack\Atmel\SAMD20_DFP\1.3.124\samd20\include

utsavZebra commented 3 years ago

Yeah. This is empty. I'm facing the same problem as last time.

image

warrenwoolseyiii commented 3 years ago

okay. delete the repo and reclone from develop, do not make the dl folder yourself, just run make and see if it pulls everything correctly.

warrenwoolseyiii commented 3 years ago

@utsavZebra any luck with this?

utsavZebra commented 3 years ago

@warrenwoolseyiii . No luck. I think maybe its to do with permission settings. I have to set chmod to accept make commands without sudo or use sudo else it doesnt work.

That might have to be done consistently for all commands in the scripts

warrenwoolseyiii commented 3 years ago

Okay I was able to reproduce your situation by creating a fresh install. Pull the latest develop.

first you have an uninstalled dependency unzip so install that sudo apt install unzip next, remove the devicepack toolchain and dl folders manually.

from there just run sudo make and you should be good to go. You can also recursively chmod each of the folders but its kind of annoying because some of the directories are made on the fly and you'd have to do it multiple times.

utsavZebra commented 3 years ago

Edit: All good now. Ill put up an issue or pull request to update doc. This is what worked for me finally on Windows Subsystem for Linux using Ubuntu 18.04 image

Dependencies

sudo apt install unzip

Build Commands for fresh clone

git clone <develop-branch>
sudo make clean-all-toolchains
sudo make distclean
sudo make

I cloned a fresh build and tried the clean-all-toolchains and distclean without sudo. It gave me a core_cm0plus.h: No such file or directory error. Hopefully this helps others. I realised you can get away with just sudo make distclean