TrampolineRTOS/trampoline

[GOIL] Is there a build-in way to add a library without updating goil templates ?

Closed this issue · 6 comments

I would like to be able to use a library (U8glib) in a simple project.
So I have imported this lib in lib/U8glib and included it #include "../lib/U8glib/U8glib.h" (I have a src/screenJoyStick.h).

But, I get some errors :

...
[100%] Linking trampuinoScreenJoyStick
build/src/screenJoyStick.cpp.o: In function `U8GLIB::write(unsigned char)':
screenJoyStick.cpp:(.text._ZN6U8GLIB5writeEh[U8GLIB::write(unsigned char)]+0xe): undefined reference to `u8g_DrawGlyph'
build/src/screenJoyStick.cpp.o: In function `periodicTask_function':
screenJoyStick.cpp:(.text.periodicTask_function+0x12): undefined reference to `u8g_Begin'
screenJoyStick.cpp:(.text.periodicTask_function+0x1a): undefined reference to `u8g_FirstPage'
build/src/screenJoyStick.cpp.o: In function `_GLOBAL__sub_I_u8g':
screenJoyStick.cpp:(.text.startup._GLOBAL__sub_I_u8g+0x28): undefined reference to `u8g_dev_st7565_nhd_c12864_sw_spi'
screenJoyStick.cpp:(.text.startup._GLOBAL__sub_I_u8g+0x2a): undefined reference to `u8g_dev_st7565_nhd_c12864_sw_spi'
screenJoyStick.cpp:(.text.startup._GLOBAL__sub_I_u8g+0x2e): undefined reference to `U8GLIB::initSPI(_u8g_dev_t*, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)'
collect2: error: ld returned 1 exit status
Return code: 1

I guess this errors are linking errors. The lib should not be included in compilation and linking process.
@guillaume-chs has fixed this here guillaume-chs@06b9571
This works but, update goil template to add a library support is not really extensible.
Do you have a solution to specify lib directory in goil configuration file ?

I have the same problem if I split my C++ code in classes :

Nothing to make.
[  5%] Compiling /path/to/trampoline/os/tpl_os_kernel.c
[ 11%] Compiling /path/to/trampoline/os/tpl_os_timeobj_kernel.c
[ 17%] Compiling /path/to/trampoline/os/tpl_os_action.c
[ 23%] Compiling /path/to/trampoline/os/tpl_os_error.c
[ 29%] Compiling /path/to/trampoline/os/tpl_os_os_kernel.c
[ 35%] Compiling /path/to/trampoline/os/tpl_os_os.c
[ 41%] Compiling /path/to/trampoline/os/tpl_os_interrupt_kernel.c
[ 47%] Compiling /path/to/trampoline/os/tpl_os_task_kernel.c
[ 52%] Compiling /path/to/trampoline/os/tpl_os_resource_kernel.c
[ 58%] Compiling /path/to/trampoline/os/tpl_os_alarm_kernel.c
[ 64%] Compiling src/screenJoyStick.cpp
[ 70%] Compiling screenJoyStick/tpl_app_config.c
[ 76%] Compiling screenJoyStick/tpl_dispatch_table.c
[ 82%] Compiling screenJoyStick/tpl_invoque.S
[ 88%] Compiling /path/to/trampoline/machines/avr/tpl_machine.c
[ 94%] Compiling /path/to/trampoline/machines/avr/arduino/main.cpp
[100%] Linking trampuinoScreenJoyStick
build/src/screenJoyStick.cpp.o: In function `setup':
screenJoyStick.cpp:(.text.setup+0x4): undefined reference to `JoyStick::getJoyStickPosition()'
build/src/screenJoyStick.cpp.o: In function `_GLOBAL__sub_I_js':
screenJoyStick.cpp:(.text.startup._GLOBAL__sub_I_js+0x8): undefined reference to `JoyStick::JoyStick(unsigned int)'
collect2: error: ld returned 1 exit status
Return code: 1

To generalize my question : do you have a solution to specify others C++ scripts in goil configuration file ?

Thanks for your great work!

Hello !

I think you'd want to use the "LIBRARY" oil definition.
Check for the oil files located in the trampoline/tests/machines directory for some examples.
Be careful, the library's relative paths are from the "trampoline/machines" directory.

In your case, something like this should do :

CPU myCPU
{
   OS myOS {
      BUILD = TRUE {
         LIBRARY = myglib;
      };
   };
   LIBRARY myglib
   {
       PATH = "path/to/U8glib";
       CPPHEADER = "U8glib.h";
       CPPFILE = "U8glib.cpp";
    };
};

See you,

Kamel Hacene

Hello,

Thanks for you interest. Another answer: If you want to add an already compiled library to the link phase, you can use the LDFLAGS attribute in the OIL file. This attribute is a sub attribute of the BUILD attribute (when true) in OS object. For example:

  OS config {
    STATUS = STANDARD;
    ARDUINO = TRUE {
      SERIAL = TRUE; //use the serial interface 
    };
    BUILD = TRUE {
      TRAMPOLINE_BASE_PATH = "../../../..";
      APP_NAME = "trampuinoBlink";
      APP_SRC = "blink.cpp";
      CPPCOMPILER = "avr-g++";
      COMPILER = "avr-gcc";
      LINKER = "avr-gcc";
      ASSEMBLER = "avr-gcc";
      COPIER = "avr-objcopy";
      SYSTEM = PYTHON;
      LDFLAGS = "-L/path/to/my/library -lmyLib";
    };
    SYSTEM_CALL = TRUE;
  };

Best regards

Hello !
Thanks for your quick answers !

I have set up the solution you gave to me.

Here is the goil configuration file :

OIL_VERSION = "2.5" : "test" ;

CPU test {    
  OS config {
    STATUS = STANDARD;
    ARDUINO = TRUE {
      SERIAL = TRUE; //use the serial interface 
      PORT = "/dev/cu.usbmodem1421"; //serial port (flash)
    };

    BUILD = TRUE {
      TRAMPOLINE_BASE_PATH = "/path/to/trampoline";
      APP_NAME = "trampuinoScreenJoyStick";
      APP_SRC = "src/screenJoyStick.cpp";
      CPPCOMPILER = "avr-g++";
      COMPILER = "avr-gcc";
      LINKER = "avr-gcc";
      ASSEMBLER = "avr-gcc";
      COPIER = "avr-objcopy";
      SYSTEM = PYTHON;
      LIBRARY = u8gb;
    };
    SYSTEM_CALL = TRUE;
  };


  LIBRARY u8gb {
     PATH = "../lib/U8glib";
  };


  APPMODE stdAppmode {};

  ALARM periodicAl {
    COUNTER= SystemCounter;
    ACTION = ACTIVATETASK {
      TASK = periodicTask;
    };
    AUTOSTART = TRUE {
      //ALARMTIME = 25;
      //CYCLETIME = 25;
      ALARMTIME = 25;
      CYCLETIME = 25;
      APPMODE = stdAppmode;
    };
  };

  TASK periodicTask {
    PRIORITY = 20;
    //AUTOSTART = FALSE;
    AUTOSTART = TRUE {APPMODE=stdAppmode;};
    ACTIVATION = 1;
    SCHEDULE = FULL;
    STACKSIZE = 256;
  };

};

When I run goil and make.py, I have the following logs :

Compiling
Replaced 'screenJoyStick/tpl_dispatch_table.c'.
Replaced 'screenJoyStick/tpl_invoque.S'.
Replaced 'screenJoyStick/tpl_invoque_isr.S'.
Replaced 'screenJoyStick/tpl_os.h'.
Replaced 'screenJoyStick/tpl_service_ids.h'.
Replaced 'build.py'.
Replaced 'make.py'.
Replaced 'screenJoyStick/tpl_app_custom_types.h'.
Replaced 'screenJoyStick/tpl_app_config.c'.
Replaced 'screenJoyStick/tpl_app_config.h'.
Replaced 'screenJoyStick/tpl_app_define.h'.
Replaced 'screenJoyStick/stm_structure.c'.
Replaced '/path/to/project/build/screenJoyStick.oil.dep'.
No warning, no error.
Deploying
Nothing to make.
No rule for making '/path/to/trampoline/machines/avr/arduino/libraries/U8glib/src/U8glib.cpp'

I have tried to change the PATH in LIBRARY configuration, but it always try to find the library in /path/to/trampoline/machines/avr/arduino/libraries/. Is it possible to point to the lib folder in the project instead of the one in trampoline ?

Regards

PS : my build.py :

#! /usr/bin/env python
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------
#--- Python Build file for application test
#--- automatically generated by goil on Mon Nov  7 16:44:27 2016
#--- from root OIL file screenJoyStick.oil
#---
#--- Compiling a Trampoline application is done in 2 stages
#--- 1 - From the OIL file, a set of files is generated as long as
#---     build options. Among these files are the build.py and make.py
#---     files. make.py contains compilation rules when the OIL file
#---     and the included OIL files are modified. make.py is only
#---     written once when the goil command is typed.
#--- 2 - From all the C/assembly files (OS, Application, librairies,
#---     configuration, ...), the objects and the executable are
#---     produced. This is done by the build.py file.
#---     build.py is generated each time goil is called by make.py
#----------------------------------------------------------------------
import sys, os, subprocess, string, distutils.spawn

#--- Add some function for Python3 support

if sys.version_info[0] >=3 :
    def bytesdecode(obj) :
        return obj.decode(sys.stdout.encoding)
else :
    def bytesdecode(obj) :
        return obj

#--- Add the location of makefile.py to the import path
sys.path.append("/path/to/trampoline/make")

#--- Import the makefile system in python
import makefile, projfile

#--- To work with relative paths
scriptDir = os.path.dirname (os.path.abspath (sys.argv[0]))
os.chdir (scriptDir)

#--- Get goal as first argument
askedGoal = "all"
if len (sys.argv) > 1 :
  askedGoal = sys.argv [1]

if askedGoal == "all" or askedGoal == "clean" :
  goal = askedGoal
else :
  goal = "all"

#--- Get max parallel jobs as second argument
maxParallelJobs = 0 # 0 means use host processor count
if len (sys.argv) > 2 :
  maxParallelJobs = int (sys.argv [2])

#--- Instanciate a new makefile object
make = makefile.Make(goal)

#----------------------------------------------------------------------
#--- Various variables used after
#----------------------------------------------------------------------
compiler = "avr-gcc"
cppCompiler = "avr-g++"
linker = "avr-gcc"
assembler = "avr-gcc"
autosar = False
autosar_sc = 0
autosar_osapplications = False
with_ioc = False
with_com = False
scheduler = "osek"
trampoline_base_path = "/path/to/trampoline/"
cflags = []
cppflags = []
ldflags = []
asflags = []
# flags that should appear at the beginning of the command.
precflags = []
precppflags = []
preldflags = []
preasflags = []
includeDirs = []

cflags += "-fpermissive -w -Wno-unused-but-set-variable -Wno-write-strings -Wno-narrowing".split()
cppflags += "-fpermissive -w -Wno-unused-but-set-variable -Wno-write-strings -Wno-narrowing".split()
cflags += "-Os -Wall -DF_CPU=16000000 -mmcu=atmega328p".split()
cppflags += "-Os -Wall -DF_CPU=16000000 -mmcu=atmega328p".split()
cflags += "-ffunction-sections".split()
cppflags += "-ffunction-sections".split()
cflags += "-fdata-sections".split()
cppflags += "-fdata-sections".split()
includeDirs += ["-I","/path/to/trampoline/machines/avr/arduino"]
includeDirs += ["-I","/path/to/trampoline/machines/avr/arduino/hardware/cores/arduino"]
includeDirs += ["-I","/path/to/trampoline/machines/avr/arduino/hardware/variants/standard"]
includeDirs += ["-I","/path/to/trampoline/machines/avr"]
includeDirs += ["-I","/path/to/trampoline/machines//bonjour/les/gens"]
if with_ioc:
  includeDirs += ["-I", "/path/to/trampoline/ioc"]
includeDirs += ["-I", "/path/to/trampoline/os"]
includeDirs += ["-I", "/path/to/trampoline/debug"]
includeDirs += ["-I", "screenJoyStick"]
cflags   += includeDirs
cppflags += includeDirs
asflags  += includeDirs

ldflags += "-DF_CPU=16000000 -mmcu=atmega328p".split()
ldflags += "-Wl,--gc-sections".split()
preldflags += "-lm".split()
asflags += "-DF_CPU=16000000 -mmcu=atmega328p".split()
preasflags += "-x assembler-with-cpp".split()

#----------------------------------------------------------------------
#--- Try to detect automatically the location of libc and libgcc
#--- This supposes the compiler has a (something)-gcc name
#--- for non posix target
#----------------------------------------------------------------------
if "gcc" in compiler:
  compilerFullPath = makefile.find_executable(compiler)
  if compilerFullPath != None:
    #--- Extract the (something) from the compiler executable name
    compilerParts = compiler.split('-')
    compilerParts.pop()
    compilerPrefix = "-".join(compilerParts)
    #--- Get the full path of the compiler
    compilerToolChainPath = os.path.dirname(os.path.dirname(compilerFullPath))
    #--- Get the version of the compiler, [:-1] removes the carriage return
    compilerVersion = subprocess.check_output([compiler, '-dumpversion'])[:-1]
    #--- Build the libc and libgcc paths
    procLibc  =subprocess.Popen([compilerFullPath,"-print-file-name=libc.a"]+cflags,stdout=subprocess.PIPE)
    procLibgcc=subprocess.Popen([compilerFullPath,"-print-libgcc-file-name"]+cflags,stdout=subprocess.PIPE)
    procLibc.wait()
    procLibgcc.wait()
    libcPath = os.path.dirname(procLibc.stdout.readline().strip())
    libgccPath = os.path.dirname(procLibgcc.stdout.readline().strip())
    #--- Add both to linker flags
    ldflags += ['-L' + libcPath, '-lc']
    ldflags += ['-L' + libgccPath, '-lgcc']

#----------------------------------------------------------------------
#--- Build the source files list
#----------------------------------------------------------------------
cSourceList = []
cppSourceList = []
sSourceList = []
oilSourceList = []

#--- OIL file
oilSourceList.append("screenJoyStick.oil")

#--- Kernel files 
cSourceList.append(projfile.ProjectFile("os/tpl_os_kernel.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_timeobj_kernel.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_action.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_error.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_os_kernel.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_os.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_interrupt_kernel.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_task_kernel.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_resource_kernel.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("os/tpl_os_alarm_kernel.c", trampoline_base_path))

#--- Add C files of the application
cSourceList.append(projfile.ProjectFile("src/screenJoyStick.cpp"))

#--- Add generated files
cSourceList.append(projfile.ProjectFile("screenJoyStick/tpl_app_config.c"))

cSourceList.append(projfile.ProjectFile("screenJoyStick/tpl_dispatch_table.c"))
cSourceList.append(projfile.ProjectFile("screenJoyStick/tpl_invoque.S"))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/main.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/U8glib.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/chessengine.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_bitmap.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_circle.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_clip.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_api.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_api_16gr.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_attiny85_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_common.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_fast_parallel.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_hw_usart_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_no_en_parallel.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_parallel.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_port_d_wr.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_ssd_i2c.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_st7920_custom.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_st7920_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_st7920_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_std_sw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_sw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_t6963.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_arduino_uc_i2c.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atmega_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atmega_parallel.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atmega_st7920_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atmega_st7920_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atmega_sw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atxmega_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_atxmega_st7920_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_i2c.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_io.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_linux_ssd_i2c.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_msp430_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_null.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_psoc5_ssd_hw_parallel.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_raspberrypi_hw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_raspberrypi_ssd_i2c.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_com_std_sw_spi.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_cursor.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_delay.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_a2_micro_printer.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_flipdisc_2x7.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_gprof.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ht1632.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ili9325d_320x240.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ks0108_128x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_lc7981_160x80.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_lc7981_240x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_lc7981_240x128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_lc7981_320x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ld7032_60x32.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_null.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_pcd8544_84x48.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_pcf8812_96x65.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_sbn1661_122x32.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1306_64x48.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1306_128x32.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1306_128x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1309_128x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1322_nhd31oled_bw.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1322_nhd31oled_gr.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1325_nhd27oled_bw.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1325_nhd27oled_bw_new.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1325_nhd27oled_gr.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1325_nhd27oled_gr_new.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1327_96x96_gr.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1351_128x128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_ssd1353_160x128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_64128n.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_dogm128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_dogm132.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_lm6059.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_lm6063.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_nhd_c12832.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7565_nhd_c12864.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7687_c144mvgd.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7920_128x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7920_192x32.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_st7920_202x32.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_t6963_128x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_t6963_128x128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_t6963_240x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_t6963_240x128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_tls8204_84x48.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1601_c128032.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1608_240x64.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1608_240x128.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1610_dogxl160.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1611_dogm240.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1611_dogxl240.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1701_dogs102.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_dev_uc1701_mini12864.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_ellipse.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_font.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_font_data.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_line.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_ll_api.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_page.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb8h1.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb8h1f.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb8h2.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb8h8.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb8v1.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb8v2.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb14v1.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb16h1.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb16h2.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb16v1.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb16v2.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pb32h1.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pbxh16.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_pbxh24.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_polygon.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_rect.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_rot.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_scale.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_state.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_u8toa.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_u16toa.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/libraries/U8glib/src/clib/u8g_virtual_screen.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/wiring_digital.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/wiring_analog.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/wiring.c", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/hooks.c", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/HardwareSerial0.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/HardwareSerial.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/HID.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/IPAddress.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/new.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/Print.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/Stream.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/Tone.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/USBCore.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/WMath.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/WString.cpp", trampoline_base_path))
cppSourceList.append(projfile.ProjectFile("machines/avr/arduino/hardware/cores/arduino/abi.cpp", trampoline_base_path))
cSourceList.append(projfile.ProjectFile("machines/avr/tpl_machine.c", trampoline_base_path))
sSourceList.append(projfile.ProjectFile("machines/avr/avr_switch_context.s", trampoline_base_path))
sSourceList.append(projfile.ProjectFile("machines/avr/tpl_dispatch.S", trampoline_base_path))
#----------------------------------------------------------------------
#--- Build the object list and the compiler dependancies
#----------------------------------------------------------------------
objectList = []

for sourceFile in cSourceList:
  source = sourceFile.src()
  object = sourceFile.obj("build")
  depObject = sourceFile.dep("build")
  objectList.append(object)
  rule = makefile.Rule([object], "Compiling " + source)
  rule.deleteTargetDirectoryOnClean()
  rule.mDependences.append(source)
  rule.mCommand.append(compiler)
  rule.mCommand += precflags
  rule.mCommand += ["-c", source]
  rule.mCommand += ["-o", object]
  rule.mCommand += ["-MD", "-MP", "-MF", depObject]
  rule.mCommand += cflags
  rule.enterSecondaryDependanceFile (depObject, make)
  make.addRule(rule)

for sourceFile in cppSourceList:
  source = sourceFile.src()
  object = sourceFile.obj("build")
  depObject = sourceFile.dep("build")
  objectList.append(object)
  rule = makefile.Rule([object], "Compiling " + source)
  rule.deleteTargetDirectoryOnClean()
  rule.mDependences.append(source)
  rule.mCommand.append(cppCompiler)
  rule.mCommand += precppflags
  rule.mCommand += ["-c", source]
  rule.mCommand += ["-o", object]
  rule.mCommand += ["-MD", "-MP", "-MF", depObject]
  rule.mCommand += cppflags
  rule.enterSecondaryDependanceFile (depObject, make)
  make.addRule(rule)

for sourceFile in sSourceList:
  source = sourceFile.src()
  object = sourceFile.obj("build")
  objectList.append(object)
  rule = makefile.Rule([object], "Assembling " + source)
  rule.mDependences.append(source)
  rule.mCommand.append(assembler)
  rule.mCommand += preasflags
  rule.mCommand += ["-c", source]
  rule.mCommand += ["-o", object]
  rule.mCommand += asflags
  make.addRule(rule)

product = "trampuinoScreenJoyStick"
rule = makefile.Rule ([product], "Linking " + product)
rule.deleteTargetFileOnClean()
rule.mDeleteTargetOnError = True
rule.mDependences += objectList
rule.mCommand += [linker]
rule.mCommand += ["-o", product]
rule.mCommand += preldflags
rule.mCommand += objectList
rule.mCommand += ldflags
if True:
  postCommand = makefile.PostCommand("Generating binary trampuinoScreenJoyStick.hex from trampuinoScreenJoyStick")
  postCommand.mCommand.append("avr-objcopy")
  postCommand.mCommand += "-O ihex".split()
  postCommand.mCommand.append("trampuinoScreenJoyStick")
  postCommand.mCommand.append("trampuinoScreenJoyStick.hex")
  rule.mPostCommands.append(postCommand)

make.addRule (rule)

make.addGoal("all", [product], "Building all")
make.addGoal("compile", objectList, "Compile source files")


make.runGoal(maxParallelJobs, maxParallelJobs == 1)

#----------------------------------------------------------------------
#--- post commands
#----------------------------------------------------------------------
if make.errorCount() == 0:
  if askedGoal == "flash" :
    commandLine = "avrdude -c arduino -p m328p "
    if os.environ.get('AVRDUDE_PORT') != None:
      commandLine += "-P" + os.environ['AVRDUDE_PORT'] + " "
    else:
      print("Cannot flash, environment variable AVRDUDE_PORT is not defined")
      exit(1)
    commandLine += "-Uflash:w:"
    commandLine += "trampuinoScreenJoyStick.hex "
    if makefile.find_executable("avrdude") != None:
      print(commandLine)
      subprocess.call(commandLine, shell=True)
    else:
      print("Command 'avrdude' not in PATH")

#----------------------------------------------------------------------
#-- End of build.py
#----------------------------------------------------------------------

The LIBRARY's PATH property defines the path to your library's directory. The past just has to be relative from your Trampoline's machines directory.

I've downloaded your library and managed to compile it with an example without problem. I don't have the full path to your lib directory so i can't give you what you need to write in that field but here's exactly what i did :

Let's say the trampoline directory is $TRAMPOLINE, and i've put the library in $TRAMPOLINE/examples/avr/arduinoUno/myExample/U8glib/

CPU mycpu {
  OS myos {
    BUILD {
      LIBRARY = glib;
    };
  };

  LIBRARY glib
  {
    PATH = "../examples/avr/arduinoUno/myExample/U8glib";
    CPPFILE = "U8glib.cpp";
    CPPHEADER = "U8glib.h";
  };
};

PATH : Tells Goil where to find the Library files.
CPPFILE : List of files to compile with your code.
CPPHEADER : List of headers to include in your code.

Also, I see that there is an "utility" directory in U8glib, so maybe you will have to add some of these files in another library like that :

CPU mycpu {
  OS myos {
    BUILD {
      LIBRARY = glib;
      LIBRARY = glib_utils;
    };
  };

  LIBRARY glib
  {
    PATH = "../examples/avr/arduinoUno/myExample/U8glib";
    CPPFILE = "U8glib.cpp";
    CPPHEADER = "U8glib.h";
  };

  LIBRARY glib_utils
  {
    PATH = "../examples/avr/arduinoUno/myExample/U8glib/utility";
    CFILE = "file1.c";
    CFILE = "file2.c";
    (...)
  };
};

See you

Hello

Seems your TRAMPOLINE_BASE_PATH attribute is not set properly. /path/to/trampoline is a pseudo path intended to make the user understand it has to be replaced with your actual path to the trampoline directory.

Best regards

Thanks for your very detailed answers.
It helped me a lot to fix my issue.
All the best for your project.
Best regards