Compiling error with sdk

I seam to have a path error that I can’t solve.

Below is the result of trying to compile, it can’t find the header file(s):

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/SparkFun_Apollo3_AmbiqSuite_BSPs/redboard_artemis/examples/blinky/gcc

$ ls -l

total 12

drwxr-xr-x 1 Home 197121 0 Jan 27 14:33 bin/

-rw-r–r-- 1 Home 197121 11739 Jan 28 08:43 Makefile

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/SparkFun_Apollo3_AmbiqSuite_BSPs/redboard_artemis/examples/blinky/gcc

$ make bootload

Makefile:134: warning: you have not defined COMMONPATH so will continue assuming that the COMMON root is at …/…/…/…/common

Makefile:142: warning: you have not defined BOARDPATH so will continue assuming that the BOARD root is at …/…/…

Makefile:150: warning: you have not defined PROJECTPATH so will continue assuming that the PROJECT root is at …

Compiling gcc …/…/…/…/common/examples/blinky/main.c

…/…/…/…/common/examples/blinky/main.c:32:10: fatal error: am_mcu_apollo.h: No such file or directory

32 | #include “am_mcu_apollo.h”

| ^~~~~~~~~~~~~~~~~

compilation terminated.

make: *** [Makefile:309: bin/main.o] Error 1

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/SparkFun_Apollo3_AmbiqSuite_BSPs/redboard_artemis/examples/blinky/gcc

$

I should have added that I am following the Sparkfun tutorial “Using SparkFun Edge Board with Ambiq Apollo3 SDK” as a guide.

Alright, looks like you are off to a decent start. Usually when the “am_mcu_apollo.h” header can’t be found it is a problem with the definition of SDKPATH.

I notice that your output is not giving a warning about SDKPATH, which means that it exists already as an environment variable (most likely). You should try “echo $SDKPATH” on your bash shell to see if it is already defined. If it is defined, and it is not the path (absolute or relative from ‘/g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/SparkFun_Apollo3_AmbiqSuite_BSPs/redboard_artemis/examples/blinky/gcc’) then that would cause your errors.

First I would recommend removing the erroneous SDKPATH variable, if you can. If you cannot because it is used for something else you can try passing it in during the build command (e.g. make bootload SDKPATH=path/to/AmbiqSuiteSDK)

Finally, I would recommend trying out our latest tools for working with Artemis - they are designed around use of a container (using Docker) so that everyone gets an identical working environment (e.g. this sort of situation doesn’t arise where your environment variables are different than mine)

You can check that out here: [https://github.com/sparkfun/artemis_dev_platform

The README has a getting started section - we just haven’t yet finished documentation on the main SF website. This is the tool I use for all my work.](GitHub - sparkfun/artemis_dev_platform: Containerized development platform for Artemis / Apollo3)

Thanks for the pointers Liquid. I’m getting this:

when I try “echo $SDKPATH” I get no response other than this:

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/boards_sfe/redboard_artemis/examples/blinky/gcc

$ echo $SDKPATH

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/boards_sfe/redboard_artemis/examples/blinky/gcc

$

Then when I set the path I get a bit farther using :

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/boards_sfe/redboard_artemis/examples/blinky/gcc

$ make bootload SDKPATH=g:/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0

Makefile:134: warning: you have not defined COMMONPATH so will continue assuming that the COMMON root is at …/…/…/…/common

Makefile:142: warning: you have not defined BOARDPATH so will continue assuming that the BOARD root is at …/…/…

Makefile:150: warning: you have not defined PROJECTPATH so will continue assuming that the PROJECT root is at …

make: *** No rule to make target ‘bin/main.o’, needed by ‘bin/blinky_svl.axf’. Stop.

Home@MAIN-PC MINGW64 /g/AmbiqSuite-Rel2.0.0/AmbiqSuite-Rel2.0.0/boards/boards_sfe/redboard_artemis/examples/blinky/gcc

$

You’re gonna hate me…just loaded blinky on Edge2 and Nano…both worked. Attached blinky makefile from my nano directory…

Makefile.txt (12.4 KB)

Glad you are able to get it to work Kerry I’m having a heck of a time.

BTW here is a shot of the board we are developing with the Artemis module…

VA3SU and KHE - First of all I would like to start by letting you know that I just updated the BSPs repo to use a new method of handling examples. Previously each board had a copy of a the makefile for each example - quite WET. Now the makefiles for most examples (e.g. blinky) is only located in boards_sfe/common/examples/{example}/gcc. The way to use it is now to either:

a) provide BOARD on the make command

cd boards_sfe/common/examples/blinky/gcc
make BOARD=redboard_artemis bootload

b) provide BOARDPATH on the make command

cd boards_sfe/common/examples/blinky/gcc
make BOARDPATH=../some/path/to/custom/board/dir bootload

(useful when you want a non-sparkfun BSP. ‘board/dir’ should contain the ‘bsp’ directory)

Alright so those changes alone probably won’t solve your problem, VA3SU. There is another factor that might be coming into play. Sometimes there was some kind of miscommunication about the configured build directory ‘example/gcc/bin’ that I never quite pinned down. I found that either running ‘make clean’ or deleting the ‘bin’ directory or creating an empty ‘bin’ directory would help. Obviously not a good solution.

The latest changes to the BSPs repo also include changes to how the ‘clean’ command works. No longer does it try to recursively remove the entire ‘bin’ directory. I think this might help. So please give the latest a try and tell us how it goes.

P.s. we are now using AmbiqSuite SDK Release 2.2.0 . I don’t think there will be problems with Blinky but the BLE example (ble_freertos_tag) definitely depends on 2.2.0 FYI

Hello Liquid

Some major progress here, thanks for your work. I updated to AmbiqSuite SDK Release 2.2.0 and used the method you just suggested to install the examples. As you can see below I’m now able to compile! The last step is uploading and I’m getting a missing file, I think it’s trying to tell me that “blinky_svl.bin” can’t be found but it’s in the bin folder with the current time/date…

Also, could you please give me the exact syntax to “clean” this folder?

Here are my results:

Home@MAIN-PC MINGW64 /g/Ambiq/AmbiqSuiteSDK/boards_sfe/common/examples/blinky/gcc ((9c31f07…))

$ make BOARD=redboard_artemis bootload

Makefile:112: Using BOARD=redboard_artemis at …/…/…/…/redboard_artemis

Makefile:121: warning: you have not defined PYTHON3. assuming it is accessible by ‘python3’

Makefile:125: defaulting to 115200 baud for ASB

Makefile:129: defaulting to 921600 baud for SVL

Makefile:134: warning: you have not defined SDKPATH so will continue assuming that the SDK root is at …/…/…/…/…

Makefile:142: warning: you have not defined COMMONPATH so will continue assuming that the COMMON root is at …/…/…/…/common

Makefile:163: warning: you have not defined PROJECTPATH so will continue assuming that the PROJECT root is at …/…/…/…/common/examples/blinky

Makefile:170: CONFIG=…/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin

Compiling gcc …/…/…/…/common/examples/blinky/main.c

Compiling gcc …/…/…/…/common/tools_sfe/templates/startup_gcc.c

Compiling gcc …/…/…/…/…/utils/am_util_delay.c

Compiling gcc …/…/…/…/…/utils/am_util_faultisr.c

Compiling gcc …/…/…/…/…/utils/am_util_stdio.c

Compiling gcc …/…/…/…/…/devices/am_devices_led.c

Linking gcc …/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.axf with script …/…/…/…/common/tools_sfe/templates/asb_svl_linker.ld

Copying gcc …/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.bin…

python3 …/…/…/…/common/tools_sfe/artemis/artemis_svl.py 67 -f …/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.bin -b 921600 -v

process_begin: CreateProcess(NULL, python3 …/…/…/…/common/tools_sfe/artemis/artemis_svl.py 67 -f …/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.bin -b 921600 -v, …) failed.

make (e=2): The system cannot find the file specified.

make: *** [Makefile:373: bootload_svl] Error 2

Home@MAIN-PC MINGW64 /g/Ambiq/AmbiqSuiteSDK/boards_sfe/common/examples/blinky/gcc ((9c31f07…))

$ ^C

Home@MAIN-PC MINGW64 /g/Ambiq/AmbiqSuiteSDK/boards_sfe/common/examples/blinky/gcc ((9c31f07…))

$ ^C

Home@MAIN-PC MINGW64 /g/Ambiq/AmbiqSuiteSDK/boards_sfe/common/examples/blinky/gcc ((9c31f07…))

$

Regards,

Kevin

Kevin, I’m curious if this error message:

python3 ../../../../common/tools_sfe/artemis/artemis_svl.py 67 -f ../../../../common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.bin -b 921600 -v
process_begin: CreateProcess(NULL, python3 ../../../../common/tools_sfe/artemis/artemis_svl.py 67 -f ../../../../common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.bin -b 921600 -v, ...) failed.
make (e=2): The system cannot find the file specified.

might actually mean that Make can’t find ‘python3’

Right now the makefiles are set up to assume that you can access the Python3 program by ‘python3’ on the command line. This is admittedly a bit non-standard. Here is a solution that might be worth a shot for you:

  1. Edit the makefiles to suit your system

This line near the beginning of the build shows the assumption.

Makefile:121: warning: you have not defined PYTHON3. assuming it is accessible by 'python3'

You should be able to provide an alternate command to access Python3.x on the make line like so:

make BOARD=redboard_artemis PYTHON3={however you would usually call python3 here} bootload

It may be possible, in the future, to eliminate the need for this option. Perhaps I could provide executable versions of the bootloaders for the different hosts (mac, linux, windows) and guess the right one to use.

Please let me know if that helps!

Or as another option you could try to call the Python script (artemis_svl.py) manually and provide the proper arguments (-f path/to/bin/file.bin -b baud_rate (921600, 115200, etc) and COMPORT)

By the way… the makefiles will also assume COM4. I will make a note of that in the getting started docs. To provide another COM PORT (either Windows or *nix style) do something like:

make BOARD={baord} PYTHON3={python3} COM_PORT={port (e.g. COM67 or /dev/ttyXXXX)}

(though I don’t see the warning message ‘warning: you have not defined COM_PORT. Assuming it is COM4’ in your output so maybe you have ‘COM_PORT’ defined as an environment variable already?

Liquid,

Thanks for the reminder, I had renamed Python3 to Python so when I put it back I get another step farther! Now there is a serial issue… (I do have the com port set correctly, 67)

Home@MAIN-PC MINGW64 /g/Ambiq/AmbiqSuiteSDK/boards_sfe/common/examples/blinky/gcc ((9c31f07…))

$ make BOARD=redboard_artemis bootload

Makefile:112: Using BOARD=redboard_artemis at …/…/…/…/redboard_artemis

Makefile:121: warning: you have not defined PYTHON3. assuming it is accessible by ‘python3’

Makefile:125: defaulting to 115200 baud for ASB

Makefile:129: defaulting to 921600 baud for SVL

Makefile:134: warning: you have not defined SDKPATH so will continue assuming that the SDK root is at …/…/…/…/…

Makefile:142: warning: you have not defined COMMONPATH so will continue assuming that the COMMON root is at …/…/…/…/common

Makefile:163: warning: you have not defined PROJECTPATH so will continue assuming that the PROJECT root is at …/…/…/…/common/examples/blinky

Makefile:170: CONFIG=…/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin

python3 …/…/…/…/common/tools_sfe/artemis/artemis_svl.py 67 -f …/…/…/…/common/examples/blinky/gcc/redboard_artemis/bin/blinky_svl.bin -b 921600 -v

Traceback (most recent call last):

File “…/…/…/…/common/tools_sfe/artemis/artemis_svl.py”, line 37, in

import serial

ModuleNotFoundError: No module named ‘serial’

make: *** [Makefile:373: bootload_svl] Error 1

Home@MAIN-PC MINGW64 /g/Ambiq/AmbiqSuiteSDK/boards_sfe/common/examples/blinky/gcc ((9c31f07…))

$

Thanks for all your help Liquid. I am now able to program the Artemis via this method.

Regards,

Kevin

As pointed, your error message image is not really too clear so for the future you might want to copy-paste as text the error message.

I reproduced your issue in my end and the root cause is just simple to get, your c file extension cannot be with a capital letter (C), as the IDE will not detect it as the C source file and will not compile it. That’s why you get undefined reference error, the function is not compiled so it cannot be linked.

Kind Regards,

Hello,

Error message is not visible correctly so not sure what is the issue.