By copying the sdk/Makefile to a ~/projects folder, I can compile the examples if I copy them to a folder in the projects folder.
However, I have now hit a snag. For one project of mine, I need to put some binary data into the app.
I thought this would be straightforward - I have a folder bindata, which contains a data.c wrapper, and a Makefile. The Makefile contains rules to build a binary file, then run xxd to generate a data.h file which is included by the data.c file.
My Makefile looks like this
#
#ifndef PDIR
GEN_LIBS = libdata.a
#endif
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile
.PHONY: FORCE
FORCE:
data.bin: root
mkimage root > data.bin
data.h: data.bin
xxd -i < data.bin > data.h
while my data.c file is like this:
const unsigned char __attribute__((section(".irom0.text"))) binary_data_start[]
= {
#include "data.h"
};
const unsigned char __attribute__((section(".irom0.text"))) binary_data_end[] =
{ 0 };
unsigned int binary_data_size = sizeof(binary_data_start);
Now, if I run ./gen_misc.sh in the top level folder, I get a problem that data.h does not exist.
If I add a dependency
data.c: data.h
then my data.h file is generated correctly, data.c is not compiled, and the following output appears:
DEPEND: xtensa-lx106-elf-gcc .... data.c
make[1]: Nothing to be done for 'data.c'
make[1]: Leaving directory '/home/pi/projects/prototype/bindata
make: *** No rule to make target 'prototype/.output/eagle/debug/lib/libbindata.a' needed by '.output/eagle/debug/image/eagle.app.v6.out'. Stop.
Obviously, I am missing a trick here. Does anyone have a suggestion to fix this problem?
It recognises that data.h needs to be generated, because of my rule, but because of that same rule, won't then compile data.c!
This is immensely frustrating.
[/code]