RobertoBenjami/stm32_graphics_display_drivers

Running with Keil? How to solve errors/warnings?

JuMalIO opened this issue · 4 comments

Can anyone run this on Keil?

I tried running but got these errors/warnings:

..\Src\App\appLcdSpeedTest.c(94): warning: #223-D: function "random" declared implicitly
x = random() % BSP_LCD_GetXSize();

..\Src\App\appLcdSpeedTest.c(373): error: #20: identifier "_impure_ptr" is undefined
_impure_ptr->_r48->_rand_next = 0;

..\Src\Lcd\lcd_io_spi.c(660): warning: #161-D: unrecognized #pragma

#pragma GCC push_options
#pragma GCC optimize("O0")
void LCD_IO_Delay(volatile uint32_t c)
{
  while(c--);
}
#pragma GCC pop_options

..\Src\Lcd\lcd_io_spi.c(721): warning: #61-D: integer operation result is out of range
..\Src\Lcd\lcd_io_spi.c(721): warning: #68-D: integer conversion resulted in a change of sign
GPIOX_MODE(MODE_PP_ALTER_50MHZ, LCD_MOSI);

....\f103c8t_app\Src\App\beer_60x100_16.c(39): error: #1077: an initializer cannot be specified for a flexible array member

How could I solve these errors/warnings?

I modified the driver for keil but couldn't try it because I don't have a licensed version (the 32kB code size limit is too low). Please test it.
The change:
random() -> rand()
_impure_ptr -> optional, I used it just to generate the same pseudorandom numbers on each run
#pragma GCC push_options -> #pragma push
#pragma GCC optimize("O0") -> #pragma O0
#pragma GCC pop_options -> #pragma pop
beer_60x100_16.c ->I did not find the right solution for this but as a forced solution bmp.h : line39 -> uint16_t data[60 * 100];

Thanks for fast response!

Project now compiles with Keil, but something is still wrong. After I upload and start the device I see screen being cleared to black color and it stops there, nothing happens after that. If I compile exact same project code with TrueStudio - application runs without issues. Where could be the issue?

Maybe these warnings which I still get are important?
..\Src\Lcd\lcd_io_spi.c(1095): warning: #61-D: integer operation result is out of range
GPIOX_MODE(MODE_PP_ALTER_50MHZ, LCD_MOSI);
..\Src\Lcd\lcd_io_spi.c(1095): warning: #61-D: integer operation result is out of range
GPIOX_MODE(MODE_PP_ALTER_50MHZ, LCD_MOSI);
..\Src\Lcd\lcd_io_spi.c(1095): warning: #68-D: integer conversion resulted in a change of sign
GPIOX_MODE(MODE_PP_ALTER_50MHZ, LCD_MOSI);

MODE_PP_ALTER_50MHZ = 0xB
LCD_MOSI = B, 15

P.S.
Found the issue. Its printf ! I have removed it from appLcdSpeedTest.c and application is running! With it application was getting into some kind of infinite loop. Why printf could be causing this?

printf:

  1. delete the syscalls.c file.
  2. http://www.keil.com/support/man/docs/uv4/uv4_db_dbg_printf_viewer.htm
    Unfortunately, I can’t test because I only have (32k code limit) Keil running in a virtual box.

Yes, printf is working after setup. Thanks for support. Your drivers are awesome! Great work! 👍