[Tutorial][Advanced]4.CLI building on GNU/Linux/Unix

Iā€™ll take another stab @ it tomorrow. I was pretty tired when walking through things. I donā€™t even remember the error I was getting.

I have a current & working makefile.I will put it here

1 Like

A working, in-production makefile

Originally from @drummyfish , refreshed for PokittoLib changes (LibAudio etc) by Jonne
ā€¦ I will also add it to the top post of this thread

Makefile (16.0 KB)

5 Likes

great, thank you! i finally got my Pokitto over the weekend and i canā€™t wait to get started. :smiley:

4 Likes

@itsonlym3 welcome, nice to meet you, have fun with your Pokitto :slight_smile: Sorry I didnā€™t reply earlier, I found the emails only now.

@jonne thank you for updating the Makefile!

2 Likes

thanks @drummyfish and you as well. this is going to be fun if i can get the hang of it. :wink:

2 Likes

used the directions @ the top of this thread, used the original Makefile and PokittoLibre and it looks like i might be on the right track.

i couldnā€™t get the updated Makefile to work.
image

I also have to admit that is has been AGES since i hacked around @ compiling things from the command line and itā€™s showing, but iā€™ll get there. :confused:

2 Likes

I havenā€™t updated PokittoLibre for quite a while, it may not be working with this Makefile and/or it may lack behind in features. I recommend you use the normal PokittoLib (Iā€™ll update the post).

OK wait, Iā€™ll take a look at the error.

EDIT:

Try to change the OBJECTS += main_pokitto.o at the top of the Makefile to the name of the file youā€™re compiling. E.g. if your program is in a file my_program.cpp, change the line to OBJECTS += my_program.o.

1 Like

awesome, thanks. going back to the original lib and Makefile, iā€™m back to my initial errors.

Compile: main.cpp
In file included from ../PokittoLib/Pokitto.h:43,
                 from ../main.cpp:1:
../PokittoLib/Pokitto_settings.h:122:8: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
  122 | inline constexpr bool POK_PERSISTENCE = PROJ_PERSISTENCE;
      |        ^~~~~~~~~
In file included from ../PokittoLib/Pokitto.h:43,
                 from ../main.cpp:1:
../PokittoLib/Pokitto_settings.h:122:8: error: 'constexpr' does not name a type
../PokittoLib/Pokitto_settings.h:122:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:127:8: error: 'constexpr' does not name a type
  127 | inline constexpr uint32_t POK_CLEAR_SCREEN = PROJ_CLEAR_SCREEN;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:127:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:132:8: error: 'constexpr' does not name a type
  132 | inline constexpr uint32_t POK_FPS = PROJ_FPS;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:132:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:133:8: error: 'constexpr' does not name a type
  133 | inline constexpr uint32_t POK_FRAMEDURATION = 1000 / PROJ_FPS;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:133:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:135:8: error: 'constexpr' does not name a type
  135 | inline constexpr uint32_t R_MASK = 0xF800;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:135:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:136:8: error: 'constexpr' does not name a type
  136 | inline constexpr uint32_t G_MASK = 0x07E0;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:136:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:137:8: error: 'constexpr' does not name a type
  137 | inline constexpr uint32_t B_MASK = 0x001F;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:137:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:139:8: error: 'constexpr' does not name a type
  139 | inline constexpr uint32_t POK_LCD_W = 220;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:139:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:140:8: error: 'constexpr' does not name a type
  140 | inline constexpr uint32_t POK_LCD_H = 176;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:140:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:259:8: error: 'constexpr' does not name a type
  259 | inline constexpr uint32_t LCDWIDTH = PROJ_LCDWIDTH;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:259:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:264:8: error: 'constexpr' does not name a type
  264 | inline constexpr uint32_t LCDHEIGHT = PROJ_LCDHEIGHT;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:264:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:270:8: error: 'constexpr' does not name a type
  270 | inline constexpr uint32_t POK_COLORDEPTH = PROJ_COLORDEPTH;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:270:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:272:8: error: 'constexpr' does not name a type
  272 | inline constexpr uint32_t BUFSIZE_NOBUFFER = 0;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:272:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:273:8: error: 'constexpr' does not name a type
  273 | inline constexpr uint32_t BUFSIZE_TASMODE = 220;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:273:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:274:8: error: 'constexpr' does not name a type
  274 | inline constexpr uint32_t BUFSIZE_TASMODELOW = 110;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:274:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:275:8: error: 'constexpr' does not name a type
  275 | inline constexpr uint32_t BUFSIZE_HI_4COLOR = ((POK_LCD_H+1)*POK_LCD_W)*POK_COLORDEPTH/8;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:275:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:276:8: error: 'constexpr' does not name a type
  276 | inline constexpr uint32_t BUFSIZE_FAST_16COLOR = (((POK_LCD_H/2)+1)*POK_LCD_W/2)*POK_COLORDEPTH/8;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:276:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:277:8: error: 'constexpr' does not name a type
  277 | inline constexpr uint32_t BUFSIZE_MODE13 = 110*88;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:277:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:278:8: error: 'constexpr' does not name a type
  278 | inline constexpr uint32_t BUFSIZE_MODE15 = 0x4BA0;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:278:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:279:8: error: 'constexpr' does not name a type
  279 | inline constexpr uint32_t BUFSIZE_MODE64 = 220*88;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:279:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:280:8: error: 'constexpr' does not name a type
  280 | inline constexpr uint32_t BUFSIZE_MIXMODE = 110*88;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:280:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:285:8: error: 'constexpr' does not name a type
  285 | inline constexpr uint32_t POK_SCREENBUFFERSIZE = PROJ_SCREENBUFFERSIZE;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:285:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:287:8: error: 'constexpr' does not name a type
  287 | inline constexpr uint32_t XCENTER = LCDWIDTH / 2;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:287:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:288:8: error: 'constexpr' does not name a type
  288 | inline constexpr uint32_t YCENTER = LCDHEIGHT / 2;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:288:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
../PokittoLib/Pokitto_settings.h:298:8: error: 'constexpr' does not name a type
  298 | inline constexpr uint32_t PALETTE_SIZE = PROJ_PALETTE_SIZE;
      |        ^~~~~~~~~
../PokittoLib/Pokitto_settings.h:298:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
In file included from ../PokittoLib/POKITTO_CORE/PokittoCore.h:57,
                 from ../PokittoLib/Pokitto.h:44,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_CORE/PokittoDisplay.h:214:29: error: 'PALETTE_SIZE' was not declared in this scope; did you mean
PROJ_PALETTE_SIZE'?
  214 |     static uint16_t palette[PALETTE_SIZE];
      |                             ^~~~~~~~~~~~
      |                             PROJ_PALETTE_SIZE
In file included from ../PokittoLib/POKITTO_CORE/PokittoCore.h:65,
                 from ../PokittoLib/Pokitto.h:44,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_CORE/PokittoSound.h:71:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17'
   71 | inline uint8_t discrete_vol = 0;
      | ^~~~~~
../PokittoLib/POKITTO_CORE/PokittoSound.h:75:12: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17'
   75 |     static inline uint16_t volumeMax = VOLUME_HEADPHONE_MAX;
      |            ^~~~~~
../PokittoLib/POKITTO_CORE/PokittoSound.h:83:12: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17'
   83 |     static inline uint8_t headPhoneLevel = 1; // a workaround to disappearing sound at low volume
      |            ^~~~~~
../PokittoLib/POKITTO_CORE/PokittoSound.h:123:12: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17'
  123 |     static inline uint16_t globalVolume;
      |            ^~~~~~
In file included from ../PokittoLib/Pokitto.h:44,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_CORE/PokittoCore.h:226:107: error: 'LCDWIDTH' was not declared in this scope
  226 | atic bool update(bool useDirectMode=false, uint8_t updRectX=0, uint8_t updRectY=0, uint8_t updRectW=LCDWIDTH, uint8_t updRectH=LCDHEIGHT);
      |                                                                                                     ^~~~~~~~

In file included from ../PokittoLib/Pokitto.h:44,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_CORE/PokittoCore.h:226:134: error: 'LCDHEIGHT' was not declared in this scope; did you mean 'PROJ_LCDHEIGHT'?
  226 | rectMode=false, uint8_t updRectX=0, uint8_t updRectY=0, uint8_t updRectW=LCDWIDTH, uint8_t updRectH=LCDHEIGHT);
      |                                                                                                     ^~~~~~~~~
      |                                                                                                     PROJ_LCDHEIGHT
In file included from ../PokittoLib/Pokitto.h:55,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_HW/PokittoEEPROM.h:42:30: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
   42 |     operator const uint8_t() const       { return **this; }
      |                              ^~~~~
../PokittoLib/POKITTO_HW/PokittoEEPROM.h:91:26: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
   91 |     operator const int() const          { return index; }
      |                          ^~~~~
In file included from ../PokittoLib/Pokitto.h:55,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_HW/PokittoEEPROM.h:144:20: warning: 'EEPROM' defined but not used [-Wunused-variable]
  144 | static EEPROMClass EEPROM;
      |                    ^~~~~~
In file included from ../PokittoLib/POKITTO_CORE/PokittoGlobs.h:50,
                 from ../PokittoLib/POKITTO_CORE/PokittoDisplay.h:73,
                 from ../PokittoLib/POKITTO_CORE/PokittoCore.h:57,
                 from ../PokittoLib/Pokitto.h:44,
                 from ../main.cpp:1:
../PokittoLib/POKITTO_HW/HWLCD.h:164:13: warning: 'void Pokitto::setup_gpio()' defined but not used [-Wunused-function]
  164 | static void setup_gpio()
      |             ^~~~~~~~~~
make[1]: *** [/home/tjbynum/git/mygame/Makefile:341: main.o] Error 1
make: *** [Makefile:27: all] Error 2

Yeah, so as the errors say, you need to tell the compiler to use the newer C++ standard, so try to replace all the flags in the Makefile that start with -std (e.g. -std=gnu++98) with -std=c++11. See if that works.

Sorry for the inconvenience, @jonne perhaps an official Linux Makefile could be added to the PokittoLib repository so that we ensure things works more smoothly on Linux? Once we work out the Makefile that works it cold just be copied to the repo.

2 Likes

will do. i only added one @ the bottom in my first attempt to fix. lol

1 Like

I am now going through the steps of the tutorial and checking everything.

2 Likes

getting a bunch of these types of errors. looks like the bulk stem from Pokitto_settings.h

../PokittoLib/Pokitto_settings.h:288:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17'
  288 | inline constexpr uint32_t YCENTER = LCDHEIGHT / 2;

iā€™ll also add (not sure if it matters) that iā€™m doing all of this under the Windows Subsystem for Linux (WSL).

1 Like

Iā€™m getting errors too, am working on it RN :slight_smile: Iā€™ll upload the corrected Makefile as soon as I have it.

Here is the Makefile that works for me with the current version of PokittoLib, following the exact steps in the tutorial (updated in the post now):

Makefile (16.2 KB)

@itsonlym3 can you test it? Just replace the Makefile and make. I donā€™t know anything about WSL, so weā€™ll see.

2 Likes
Compile: cmsis_nvic.c
Compile: system_LPC11U6x.c
Compile: analogin_api.c
Compile: gpio_api.c
Compile: gpio_irq_api.c
Compile: i2c_api.c
Compile: pinmap.c
Compile: pwmout_api.c
Compile: rtc_api.c
Compile: serial_api.c
Compile: sleep.c
Compile: spi_api.c
Compile: us_ticker.c
link: game.elf
'../gtc/arm-none-eabi-objcopy' -O binary game.elf firmware.bin
===== bin file ready to flash: BUILD/firmware.bin =====
'../gtc/arm-none-eabi-objcopy' -O ihex game.elf game.hex
:
make: 'all' is up to date.
itsonlym3@uscit01:~/git/mygame$

itsonlym3@uscit01:~/git/mygame$ ls BUILD/
PokittoLib  firmware.bin  game.elf  game.hex  game.link_script.ld  main.d  main.o
itsonlym3@uscit01:~/git/mygame$

w00t, thank you!!!

3 Likes

i was also able to get PokittoEmu to compile after installing:

libsdl2-dev
libsdl2-net-dev
libsdl2-image-dev

thanks again @drummyfish and @jonne , canā€™t think thank you enough.

2 Likes

I presume @drummyfish figured out the problem, but to spell it out for the sake of future readers:

The library has to be compiled as C++17 now because itā€™s using C++17 exclusive features like inline variables.

4 Likes

The Makefile is missing the -D_OSCT=2 from the C_FLAGS and CXX_FLAGS which compiles the program in overclocked mode which has become the default when using FemtoIDE.

Perhaps it may or may not be best to default to overclocked mode, Iā€™m not sure. For those who wish to use the Makefile and would like to have overclocking enabled just add the following two lines to the Makefile (you should see where the rest of the C_FLAGS and CXX_FLAGS are set):

C_FLAGS = -D_OSCT=2
CXX_FLAGS = -D_OSCT=2
6 Likes

thanks @Pharap and @tuxinator2009

2 Likes