Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 9 months ago.
problem when compiling with external gcc toolchain
Everything works great when I compile it in mbed. Great Job!
However - I exported the code as GCC Arm (Embedded) and tried to compile. Everything runs through pretty smooth until:
./TFT_fonts/Arial12x12.h:8:8: error: expected constructor, destructor, or type conversion before '(' token align(2) ^
./TFT_fonts/Arial24x23.h:10:8: error: expected constructor, destructor, or type conversion before '(' token align(2) ^
./TFT_fonts/Arial28x28.h:10:8: error: expected constructor, destructor, or type conversion before '(' token align(2) ^
./TFT_fonts/font_big.h:10:8: error: expected constructor, destructor, or type conversion before '(' token align(2) ^
Any Ideas ?
Thanks so much!!
Question relating to:
3 Answers
8 years, 6 months ago.
Hello,
Try to modify the font declaration in the header file as follows:
const unsigned char Arial12x12[] __attribute__ ((aligned (2))) = { ... };
Zoltan
Hi Zoltan, Could you please tell me why you need to do it?
In some examples when I do this I get lots of warnings
in a file called pitch.h from the UniGraphics Demos
" ../pict.h:35:1: warning: narrowing conversion of 'XXX' from 'int' to 'char' inside { } is ill-formed in C++11 [-Wnarrowing] "
posted by 22 Jun 2016Hello Eryk,
I would like to apologize for a mistake I made.The alignment shall be on two bytes, not on one as I originally suggested (now it's fixed). I'm not hundred per cent sure but I think it is to optimize the amount of used memory and the efficiency of retrieving the data from the memory.
See https://en.wikipedia.org/wiki/Data_structure_alignment for more details.
Zoltan
8 years, 6 months ago.
The SPI_TFT_IL9341 lib is deprecated. Please use the UniGraphic lib for new projects. https://developer.mbed.org/teams/GraphicsDisplay/code/UniGraphic/ This has fixed font declarations. You can also use them in your project.
Peter