devbis / st7789_mpy

Fast pure-C driver for MicroPython that can handle display modules on ST7789 chip
MIT License
195 stars 43 forks source link

Compile error onSTM32 port #12

Closed garatronic closed 4 years ago

garatronic commented 4 years ago

Hi,

I did a try on stm32 port. My arm-none-eabi-gcc version is : gcc version 8.3.1 20190703 (release) [gcc-8-branch revision 273027] (GNU Tools for Arm Embedded Processors 8-2019-q3-update)

Something wrong with syntax. Any idea ?

Including User C Module from ../../../st7789_mpy//st7789
CC ../../../st7789_mpy/st7789/st7789.c
In file included from ../../py/mphal.h:34,
                 from ../../../st7789_mpy/st7789/st7789.c:30:
../../../st7789_mpy/st7789/st7789.c: In function 'write_cmd':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:41:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_LOW()     (mp_hal_pin_write(self->dc, 0))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:88:9: note: in expansion of macro 'DC_LOW'
         DC_LOW();
         ^~~~~~
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:92:9: note: in expansion of macro 'DC_HIGH'
         DC_HIGH();
         ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'draw_pixel':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:139:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'fast_hline':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:149:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'fast_vline':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:158:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_hard_reset':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:44:23: note: in expansion of macro 'mp_hal_pin_write'
 #define RESET_HIGH() (mp_hal_pin_write(self->reset, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:169:5: note: in expansion of macro 'RESET_HIGH'
     RESET_HIGH();
     ^~~~~~~~~~
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:43:23: note: in expansion of macro 'mp_hal_pin_write'
 #define RESET_LOW()  (mp_hal_pin_write(self->reset, 0))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:171:5: note: in expansion of macro 'RESET_LOW'
     RESET_LOW();
     ^~~~~~~~~
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:44:23: note: in expansion of macro 'mp_hal_pin_write'
 #define RESET_HIGH() (mp_hal_pin_write(self->reset, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:173:5: note: in expansion of macro 'RESET_HIGH'
     RESET_HIGH();
     ^~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_fill_rect':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:253:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_fill':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:268:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_blit_buffer':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:358:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_on':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:45:22: note: in expansion of macro 'mp_hal_pin_write'
 #define DISP_HIGH() (mp_hal_pin_write(self->backlight, 1))
                      ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:414:5: note: in expansion of macro 'DISP_HIGH'
     DISP_HIGH();
     ^~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:413:26: error: unused variable 'self' [-Werror=unused-variable]
     st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
                          ^~~~
In file included from ../../py/mphal.h:34,
                 from ../../../st7789_mpy/st7789/st7789.c:30:
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_off':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:46:21: note: in expansion of macro 'mp_hal_pin_write'
 #define DISP_LOW() (mp_hal_pin_write(self->backlight, 0))
                     ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:423:5: note: in expansion of macro 'DISP_LOW'
     DISP_LOW();
     ^~~~~~~~
../../../st7789_mpy/st7789/st7789.c:422:26: error: unused variable 'self' [-Werror=unused-variable]
     st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
                          ^~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_make_new':
../../../st7789_mpy/st7789/st7789.c:552:29: error: implicit declaration of function 'MP_ERROR_TEXT'; did you mean 'MP_ROM_INT'? [-Werror=implicit-function-declaration]
         mp_raise_ValueError(MP_ERROR_TEXT("Unsupported display. Only 240x240 and 135x240 are supported without xstart and ystart provided"));
                             ^~~~~~~~~~~~~
                             MP_ROM_INT
../../../st7789_mpy/st7789/st7789.c:552:29: error: passing argument 1 of 'mp_raise_ValueError' makes pointer from integer without a cast [-Werror=int-conversion]
         mp_raise_ValueError(MP_ERROR_TEXT("Unsupported display. Only 240x240 and 135x240 are supported without xstart and ystart provided"));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../st7789_mpy/st7789/st7789.c:28:
../../py/runtime.h:154:47: note: expected 'const char *' but argument is of type 'int'
 NORETURN void mp_raise_ValueError(const char *msg);
                                   ~~~~~~~~~~~~^~~
../../../st7789_mpy/st7789/st7789.c:557:29: error: passing argument 1 of 'mp_raise_ValueError' makes pointer from integer without a cast [-Werror=int-conversion]
         mp_raise_ValueError(MP_ERROR_TEXT("must specify all of reset/dc pins"));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../st7789_mpy/st7789/st7789.c:28:
../../py/runtime.h:154:47: note: expected 'const char *' but argument is of type 'int'
 NORETURN void mp_raise_ValueError(const char *msg);
                                   ~~~~~~~~~~~~^~~
cc1: all warnings being treated as errors
../../py/mkrules.mk:47 : la recette pour la cible « build-RESA_PYBSTICK26/st7789/st7789.o » a échouée
make: *** [build-RESA_PYBSTICK26/st7789/st7789.o] Erreur 1
devbis commented 4 years ago

Thanks for the feedback. Fixed in 4707890