-->
Page 1 of 1

micro-builder: Multi-platform build environment

PostPosted: Tue Jan 05, 2016 12:29 am
by zorxx
For anyone interested, here is a new (and currently very rough) build tool that can be used for creating ESP8266 applications, and (hopefully, eventually) applications for many other architectures. Feedback welcome:

https://github.com/zorxx/micro-builder

You may ask: How is this different from every other build tool?
- It's designed to make use of other existing projects. You want to build an application for a microcontroller and want to make use of all of the great libraries, SDKs, and tools that have been developed. micro-builder provides the infrastructure for pulling-in applications and tools into your build, so you can just make use of them.
- micro-builder just handles building. You're not forced to develop in an IDE you don't like. micro-builder currently has a package for the excellent ESP8266/Arduino toolchain/libraries, so you can develop and build an "Arduino" application without using the Arduino IDE. If you prefer, you can build an application against the bare-bones ESP8266 SDK from Expressif using the excellent sysinternals ESP8266 toolchain (which is built for windows hosts only). micro-builder currently includes packages for all of this.
- Build on multiple hosts. The packages currently included have been minimally tested on MinGW and 64-bit Linux. Note that some packages are host architecture dependent (e.g. sysinternals toolchain for Windows hosts only).

Please remember: micro-builder is brand-new and very immature. Any feedback is welcome.

From the README:
micro-builder: Build Environment for Microcontroller Projects

Goals:
- Simple, flexible environment for building applications for microcontrollers
- Make use of existing projects (don't re-invent wheels)

Build Environment:
- Rely only on GNU make. Never assume any particular shell exists (e.g. bash). This makes
portability of the build environment among platforms (e.g. Windows and Linux) possible.
- Never rely on absolute paths. The micro-builder root directory can exist anywhere.
- "make" can be executed from any directory in the build source tree (e.g. to build individual
example applications or all example applications)

Packages:
The packages directory contains recipes for downloading and optionally building packages
from external projects. Examples of packages are: toolchains, target flashing and debugging
tools, libraries, applications, etc. The two major components of a package are

- Makefile
This contains all of the information for downloading and building the package
- <package_name>.inc
When the package is included by the user in /config.inc, this file is included
in the build environment. This allows the package to provide things to the build
environment, such as include file directories (for library packages) or toolchain
binary locations (for toolchain packages).

Libraries:
Some libraries exist directly within the micro-builder source tree. Eventually, these
libraries may be split into separate git projects (and be included as packages in
micro-builder).

Examples:
Some example applications exist directly within the micro-builder source tree. Eventually,
these applications may be split into separate git projects (and be included as packages in
micro-builder).

Notes:
Some aspects of micro-builder are similar to Buildroot, however there are some key differences:
- micro-builder is designed to allow for development of applications.
- Selected packages determine the build environment. Adding a new package can change the way
all applications/libraries are built.

Re: micro-builder: Multi-platform build environment

PostPosted: Sun Jan 10, 2016 9:50 pm
by gsker
zorxx wrote:Please remember: micro-builder is brand-new and very immature. Any feedback is welcome.


I ran git clone. Then make.
It did a bunch of stuff including getting the xtensa tool chain. I let it go with some warnings.

After it stopped I ran make again and got this:

Code: Select allgsker@veeta:/work/esp8266/micro-builder> make
Building subdirectory: package
Building subdirectory: common
make[4]: '/work/esp8266/micro-builder/include/../lib/bin/libTemperatureControl.a' is up to date.
make[4]: '/work/esp8266/micro-builder/include/../lib/bin/libOneWire.a' is up to date.
Building subdirectory: esp8266
Download file: "linux64-xtensa-lx106-elf-gb404fb9.tar.gz"
make[3]: Nothing to be done for 'all'.
make[3]: Nothing to be done for 'all'.
make[4]: '/work/esp8266/micro-builder/include/../lib/bin/libesp8266_arduino_core.a' is up to date.
make[4]: '/work/esp8266/micro-builder/include/../lib/bin/libesp8266_arduino_eeprom.a' is up to date.
make[4]: '/work/esp8266/micro-builder/include/../lib/bin/libesp8266_arduino_wifi.a' is up to date.
make[4]: '/work/esp8266/micro-builder/include/../lib/bin/libesp8266_arduino_mDNS.a' is up to date.
Building subdirectory: lib
Building subdirectory: common
make[2]: 'all' is up to date.
Building subdirectory: esp8266
make[3]: Nothing to be done for 'all'.
Building subdirectory: examples
Building subdirectory: common
make[3]: Nothing to be done for 'all'.
LD ds18b20.out
/work/esp8266/micro-builder/package/esp8266/esp8266_arduino_toolchain/source/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: cannot find -lesp8266_arduino
collect2: error: ld returned 1 exit status
../../../include/mb.inc:123: recipe for target 'build/ds18b20.out' failed
make[3]: *** [build/ds18b20.out] Error 1
make[3]: Nothing to be done for 'all'.
Building subdirectory: esp8266
CC hello_world.c
In file included from hello_world.c:5:0:
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:148:20: error: unknown type name 'size_t'
 void *pvPortMalloc(size_t xWantedSize, const char* file, int line) __attribute__((malloc, alloc_size(1)));
                    ^
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:149:32: error: unknown type name 'size_t'
 void *pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line) __attribute__((alloc_size(2)));
                                ^
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:151:47: error: unknown type name 'size_t'
 void *ets_memcpy(void *dest, const void *src, size_t n);
                                               ^
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:152:34: error: unknown type name 'size_t'
 void *ets_memset(void *s, int c, size_t n);
                                  ^
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:161:48: error: unknown type name 'size_t'
 char *ets_strncpy(char *dest, const char *src, size_t n);
                                                ^
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:164:28: error: unknown type name 'size_t'
 int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
                            ^
/work/esp8266/micro-builder/include/../package/esp8266/esp8266_arduino/source/tools/sdk/include/ets_sys.h:173:29: error: unknown type name 'size_t'
 int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg)  __attribute__ ((format (printf, 3, 0)));
                             ^
../../../include/mb.inc:74: recipe for target 'build/hello_world.o' failed
make[3]: *** [build/hello_world.o] Error 1
Makefile:10: recipe for target 'all' failed
make[2]: *** [all] Error 2
Makefile:9: recipe for target 'all' failed
make[1]: *** [all] Error 2
Makefile:18: recipe for target 'subdirs' failed
make: *** [subdirs] Error 2


HTH.
Ger

Re: micro-builder: Multi-platform build environment

PostPosted: Tue Jan 12, 2016 9:13 pm
by zorxx
Thanks for the feedback.

The compiler errors you were seeing were a result of builds of applications/libraries that didn't have the proper dependencies met. For example, the blink application requires the esp8266/arduino package to be enabled (in config.inc), but the hello_world application is designed to build against the "raw" esp8266 sdk from Expressif (esp8266/esp8266_sdk package).

I've just pushed changes to the build environment to support specification of package dependencies by libraries and applications. Now, a build at the top level of the micro-builder source tree should build only the applications/libraries that have the proper dependencies selected.

On a related note, I have plans for adding support for a configuration/selection user interface to make it easy to see all of the available packages. I'm looking at using Kconfig, although it's not friendly for host environments other than Linux...

With the default configuration (config.inc) at the head of the git repo, you should no longer see compile/link errors if you perform a make from the root of the build tree.