So my project is a Lora gateway (sx1302 chip) connected to AM62 Mallow board.
I checkout the library sx1302_hal written in C.
Goal is to build this library for am62 target and use the Lora function to scan and collect data from local lora water metering equipment.
First, my starting point was to create a new container project based on vscode extension2 torizon C template.
The sx1302_hal folder is placed into src/ folder.
I modified the makefile to first, build the sx1302_hal archive (sx1302 makefile target) , and then run the 'toradex ’ origin debug target. By doing that, i’m sure to have the libxxx.a with all the code i will use in my main.c ( or additional .c files) cross compiled for my target arm64 am62 board.

sx1302_hal:
$(MAKE) all -e -C src/sx1302_hal
.PHONY: debug
debug: sx1302_hal $(TARGET_DEBUG)
To use the library, i add -l and -L options to the LDFLAGS:
CC := gcc
CCFLAGS := -Iincludes/ -Isrc/sx1302_hal/libloragw/inc
DBGFLAGS := -g
LDFLAGS := -Lsrc/sx1302_hal/libloragw/ -Lsrc/sx1302_hal/libtools -lloragw -lm -lparson -lbase64 -ltinymt32 #-lm is for math.h (to avoid compile errors :pow , log10 functions calls)
CCOBJFLAGS := $(CCFLAGS) -c
ARCH :=
- Issues I met were:
->Pb1 : sometimes modifications done in src files were not taken into account by the makefile, so object files were not regenerated.
->Pb2 : If i removed the main.o, not regerated and then ask for it in compilation errors (make).
->Pb3: Container pull step were giving error 18 on my stationnary pc.
Pb1: fixed when create a new project
Pb2: fixed by replacing makefile
Pb3: fixed by moving from my home network to the work pc and work network
So to conclude, to day all is working.
I think that playing and experimenting with makefile, VS an extension at same times created some stange situations.
Now, i’m able to call a function of the sx1302 library ( just get_version(), not yet real communication with the hardware), but it is a good start.
I’m learning by doing so i feel sorry to create tickets sometimes for that, but the toradex way of working is closer to devOps than microcontroler engineer like me
, so i just need time to improve my skills.
So next step will be to create a dts file to connect my sx1302 gateway to the mallow board and prey that it works
.
Thanks for your time Jeremias.
See you in the next tickets 