jithurbide Posted June 11, 2015 Report Posted June 11, 2015 Hello,I'm trying to use ugfx with chibios on mikromedia stm32 board. I can't compile a simple program with chibistudio. Can somebody help me?I setup a new project based on the rt-stm32f407-discovery. I copy the last ugfx code source on c:\chibistudio\ugfxI use the workspace3.I modified my Makefile like that :############################################################################### Build global options# NOTE: Can be overridden externally.## Compiler options here.ifeq ($(USE_OPT),) # Replace -O0 with -O2 for a production build. -O2 just messes with the debugger. USE_OPT = -O0 -g -fomit-frame-pointer -falign-functions=16endif# C specific options here (added to USE_OPT).ifeq ($(USE_COPT),) USE_COPT = endif# C++ specific options here (added to USE_OPT).ifeq ($(USE_CPPOPT),) USE_CPPOPT = -fno-rttiendif# Enable this if you want the linker to remove unused code and dataifeq ($(USE_LINK_GC),) USE_LINK_GC = yesendif# Linker extra options here.ifeq ($(USE_LDOPT),) USE_LDOPT = endif# Enable this if you want link time optimizations (LTO)ifeq ($(USE_LTO),) ### disable as can cause segfault USE_LTO = noendif# If enabled, this option allows to compile the application in THUMB mode.ifeq ($(USE_THUMB),) USE_THUMB = yesendif# Enable this if you want to see the full log while compiling.ifeq ($(USE_VERBOSE_COMPILE),) USE_VERBOSE_COMPILE = noendif## Build global options############################################################################################################################################################## Architecture or project specific options## Stack size to be allocated to the Cortex-M process stack. This stack is# the stack used by the main() thread.ifeq ($(USE_PROCESS_STACKSIZE),) USE_PROCESS_STACKSIZE = 0x400endif# Stack size to the allocated to the Cortex-M main/exceptions stack. This# stack is used for processing interrupts and exceptions.ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400endif# Enables the use of FPU on Cortex-M4 (no, softfp, hard).ifeq ($(USE_FPU),) USE_FPU = noendif## Architecture or project specific options############################################################################################################################################################# Project, sources and paths#SW = ..# Define project name herePROJECT = ch# Imported source files and pathsCHIBIOS = ../../chibios3GFXLIB = ../../ugfx#include $(CHIBIOS)/boards/MIKROMEDIA_STM32_M4/board.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk # Not a standard ChibiOS supported boardinclude $(CHIBIOS)/os/hal/hal.mkinclude $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mkinclude $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/board.mkinclude $(CHIBIOS)/os/hal/osal/rt/osal.mkinclude $(CHIBIOS)/os/rt/rt.mkinclude $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mkinclude $(CHIBIOS)/test/rt/test.mkLDSCRIPT= $(PORTLD)/STM32F407xG.ld# Imported source files and paths for uGFXinclude $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/board.mkinclude $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.mk # The replacement ChibiOS board filesinclude $(GFXLIB)/gfx.mk# Where is our source code - alter these for your project.# Either just include the demo makefile or add your own definitionsinclude $(GFXLIB)/demos/modules/gdisp/basics/demo.mk#MYFILES = my-project-directory#MYCSRC = $(MYFILES)/main.c#MYDEFS =# C sources that can be compiled in ARM or THUMB mode depending on the global# setting.CSRC = $(STARTUPSRC) \ $(KERNSRC) \ $(PORTSRC) \ $(OSALSRC) \ $(HALSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ $(TESTSRC) \ main.c# C++ sources that can be compiled in ARM or THUMB mode depending on the global# setting.CPPSRC =# C sources to be compiled in ARM mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.ACSRC =# C++ sources to be compiled in ARM mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.ACPPSRC =# C sources to be compiled in THUMB mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.TCSRC =# C sources to be compiled in THUMB mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.TCPPSRC =# List ASM source files hereASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ $(CHIBIOS)/os/various## Project, sources and paths############################################################################################################################################################# Compiler settings#MCU = cortex-m4#TRGT = arm-elf-TRGT = arm-none-eabi-CC = $(TRGT)gccCPPC = $(TRGT)g++# Enable loading with g++ only if you need C++ runtime support.# NOTE: You can use C++ even without C++ support if you are careful. C++# runtime support makes code size explode.LD = $(TRGT)gcc#LD = $(TRGT)g++CP = $(TRGT)objcopyAS = $(TRGT)gcc -x assembler-with-cppOD = $(TRGT)objdumpSZ = $(TRGT)sizeHEX = $(CP) -O ihexBIN = $(CP) -O binary# ARM-specific options hereAOPT =# THUMB-specific options hereTOPT = -mthumb -DTHUMB# Define C warning options hereCWARN = -Wall -Wextra -Wstrict-prototypes# Define C++ warning options hereCPPWARN = -Wall -Wextra## Compiler settings############################################################################################################################################################# Start of default section## List all default C defines here, like -D_DEBUG=1DDEFS = $(GFXDEFS)# List all default ASM defines here, like -D_DEBUG=1DADEFS =# List all default directories to look for include files hereDINCDIR =# List the default directory to look for the libraries hereDLIBDIR =# List all default libraries hereDLIBS =## End of default section############################################################################################################################################################# Start of user section## List all user C define here, like -D_DEBUG=1UDEFS =# Define ASM defines hereUADEFS =# List all user directories hereUINCDIR =# List the user directory to look for the libraries hereULIBDIR =# List all user libraries hereULIBS =## End of user defines##############################################################################RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCCinclude $(RULESPATH)/rules.mkplease find the error I have :------------------------------------------------------------------------In file included from ../../chibios3/os/hal/include/hal.h:32:0, from ../../chibios3/os/hal/src/hal.c:25:../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1087:2: error: #error "STM32_PLLVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1099:2: error: #error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1119:2: error: #error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1198:2: error: #error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1222:2: error: #error "STM32_PCLK1 exceeding maximum frequency (STM32_PCLK1_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1246:2: error: #error "STM32_PCLK2 exceeding maximum frequency (STM32_PCLK2_MAX)"In file included from ../../chibios3/os/hal/include/usb.h:362:0, from ../../chibios3/os/hal/include/hal.h:62, from ../../chibios3/os/hal/src/hal.c:25:../../chibios3/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h:188:2: error: #error "the USB OTG driver requires a 48MHz clock"make: *** [build/obj/hal.o] Error 1make: *** Waiting for unfinished jobs....Compiling hal_queues.cIn file included from ../../chibios3/os/hal/include/hal.h:32:0, from ../../chibios3/os/hal/src/hal_queues.c:38:../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1087:2: error: #error "STM32_PLLVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1099:2: error: #error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1119:2: error: #error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1198:2: error: #error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1222:2: error: #error "STM32_PCLK1 exceeding maximum frequency (STM32_PCLK1_MAX)"../../chibios3/os/hal/ports/STM32/STM32F4xx/hal_lld.h:1246:2: error: #error "STM32_PCLK2 exceeding maximum frequency (STM32_PCLK2_MAX)"In file included from ../../chibios3/os/hal/include/usb.h:362:0, from ../../chibios3/os/hal/include/hal.h:62, from ../../chibios3/os/hal/src/hal_queues.c:38:../../chibios3/os/hal/ports/STM32/LLD/OTGv1/usb_lld.h:188:2: error: #error "the USB OTG driver requires a 48MHz clock"make: *** [build/obj/hal_queues.o] Error 1--------------------------------------------------------------------------------------------------------------------------------------------------------If I modify the board file provided form :#if !defined(STM32_HSECLK)#define STM32_HSECLK 16000000#endifto :#if !defined(STM32_HSECLK)#define STM32_HSECLK 8000000U#endifbut now I have this :-------------------------------------------------------------------------------------------------------------------------------------------------------------Compiling flash_memory.c../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:14:1: error: unknown type name 'SPIConfig'../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:16:3: warning: excess elements in scalar initializer [enabled by default]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:16:3: warning: (near initialization for 'flash_spicfg') [enabled by default]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:17:3: warning: excess elements in scalar initializer [enabled by default]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:17:3: warning: (near initialization for 'flash_spicfg') [enabled by default]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:19:1: warning: excess elements in scalar initializer [enabled by default]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:19:1: warning: (near initialization for 'flash_spicfg') [enabled by default]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c: In function 'flash_is_write_busy':../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:27:3: warning: implicit declaration of function 'spiAcquireBus' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:27:18: error: 'SPID3' undeclared (first use in this function)../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:27:18: note: each undeclared identifier is reported only once for each function it appears in../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:28:3: warning: implicit declaration of function 'spiStart' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:29:3: warning: implicit declaration of function 'spiSelect' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:30:3: warning: implicit declaration of function 'spiSend' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:31:3: warning: implicit declaration of function 'spiReceive' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:32:3: warning: implicit declaration of function 'spiUnselect' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:33:3: warning: implicit declaration of function 'spiReleaseBus' [-Wimplicit-function-declaration]../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c: In function 'flash_write_enable':../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:39:18: error: 'SPID3' undeclared (first use in this function)../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c: In function 'flash_sector_erase':../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:56:18: error: 'SPID3' undeclared (first use in this function)../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c: In function 'flash_read':../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:74:18: error: 'SPID3' undeclared (first use in this function)../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c: In function 'flash_write':../../ugfx/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c:93:18: error: 'SPID3' undeclared (first use in this function)make: *** [build/obj/flash_memory.o] Error 1make: *** Waiting for unfinished jobs....------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Can someone help me configuring chibios/ugfx woth mikromedia stm32 board ? Is there anyone successfully compile ugfx on this board?Regards,Julien
inmarket Posted June 11, 2015 Report Posted June 11, 2015 In the ugfx tree there is a directory for each of the two mikromedia STM32 m4 boards. In those subdirectories is an example project for Chibios V2 and chibios V3. Copy the files from that directory to your project directory and use that makefile as a starting point.There are two problems going on here...1/ chibios board files are not provided by chibios for the mikromedia boards. We have included them as part of the ugfx directory tree.2/ The chibios makefile does not know how to build ugfx. The ugfx makefile however knows how to build both ugfx and chibios so the ugfx makefile is the best one to use (and in our mind is much simpler for a user anyway).I hope that helps. Let us know of any more troubles you have.
inmarket Posted June 11, 2015 Report Posted June 11, 2015 Just a additional thought...If you have one of the non m4 versions of the mikromedia boards you are still better off using our example m4 project but just change the cpu definition in the makefile. The reason is that I believe that mikromedia use largely consistant pin outs etc across their boards and just change the cpu. So you might still need to make modifications but it is a much better starting point than the STM32 100 board files.
jithurbide Posted June 12, 2015 Author Report Posted June 12, 2015 Hello,Thanks for your answer.I have the mikromedia stm32f4 board. I still have some issue when I use only your files. First the file : chibios3\os\rt\ports\ARMCMx\compilers\GCC\mk\port_stm32f4xx.mkis not existing any more. I just create it (by coping the port_v7m.mk) but after that :../../ChibiOS3/os/rt/ports/ARMCMx/chcore.h:70:22: fatal error: cmparams.h: No such file or directoryCould you please tell me witch version of chibios3 you have using ? I'll download it and try with it.Julien
inmarket Posted June 12, 2015 Report Posted June 12, 2015 Unfortunately chibios V3 is not stable. We have found lots of this sort of thing happening from time to time.Chibios V2 is much more stable although Giovanni from chibios sneaks changes to the api in from time to time that breaks things. The latest V2 version should work.I will look at updating the V3 chibios files as soon as I get a chance. Alternatively you could do that for us, we would definitely appreciate the contribution. The mikromedia STM32 m4 board with chibios V2.6.7 is what I use for a lot of my own development.
jithurbide Posted June 13, 2015 Author Report Posted June 13, 2015 Ok, then I try today with chibios2. Now, I can compile my program. But. when I want to load the hex file to the board with openocd it doesn't work. I use the config file on the chibiosv2 folder. And I use the official st-linkv2.Did you have any idea why ...Open On-Chip Debugger 0.9.0-dev-00268-ga9c90a0 (2015-02-08-10:38)Licensed under GNU GPL v2For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html##### Loading debugger...Warn : Interface already configured, ignoringError: already specified hl_layout stlink##### Loading CPU...WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfgError: session transport was not selected. Use 'transport select 'Info : session transport was not selected, defaulting to JTAGError: Debug adapter doesn't support 'jtag' transportRuntime Error: embedded:startup.tcl:20: in procedure 'script' at file "embedded:startup.tcl", line 58at file "C:\ChibiStudio\ugfx\boards\base\Mikromedia-STM32-M4-ILI9341\example_chibios_2.x\openocd.cfg", line 35at file "C:/ChibiStudio/tools/openocd//scripts/target/stm32f4x_stlink.cfg", line 2at file "C:/ChibiStudio/tools/openocd//scripts/target/stm32f4x.cfg", line 6in procedure 'transport' called at file "C:/ChibiStudio/tools/openocd//scripts/target/swj-dp.tcl", line 23in procedure 'ocd_bouncer' at file "embedded:startup.tcl", line 20
inmarket Posted June 13, 2015 Report Posted June 13, 2015 There are a few things that might be happening here. ..1/ The openocd file provided is designed to be used with the openocd driver for the st-link. If you are using the official st-link drivers you may need to change some lines in the file to match. 2/ openocd is a project that changes its api over time. It could be a version issue of openocd. The scripts have already been upgraded several times to take this into account. Maybe it is time to do it again. Later when I am on my computer I will look at which version we are currently using. I think this is the most likely issue.3/ The scripts as provided are designed to be used using a combination of the script itself and parameters. The parameters tell it what to do eg whether to upload, or act as a debug target. It should be relatively obvious from the script itself but I can't remember how or if I documented how to use it.
jithurbide Posted June 15, 2015 Author Report Posted June 15, 2015 Thanks for your answer. When you say openocd use is own driver, where I can find it? I try to find on opencd the driver and dont fint it. That the reason I intall the original one. Could you tell me if it is possible to do a debug session with the st-linkv2 mikroprog adaptor? I have now sucessfuly compile and transfer a simple program. But my screen stay white. I try to find witch model I use but I cant find it. Did you know how I can check I use correct board (with the correct screen)?Did someone use chibistudio? i have one issue with it. When I transfer the efl file, chibistudio tell me that he cant find source file and seems to stop.I dont have many time to test it, but I also try to use the USB as a serial port to be sure the soft is running. I still have an issue during the compilation... I cant really tell is the soft is running or not in my board. I know the soft was transfering because first I transfer a demo from mikroe. And after i compile/ download my soft the screen change to white.
jithurbide Posted June 15, 2015 Author Report Posted June 15, 2015 Hello,Just to inform you it's finally working!!! I successfully compile, download and run a demo on my board with chibistudio. Did you have any possibility to open me your wiki. I will do a step by step tutorial on how to use chibistudio. If not I will do it on my web server and provide here a link.I really need to run my own chibios on this board and I'll try to write all the step I do during my learning step. I will try also to provide you some patch because I modify some one step after other ....I just need one more information. I try to compile tetris and also bubbles examples. When I compile, I have some error message regards math function (like round,sinf and sqrt) . Did you know if I can do something to correct this ?
Joel Bodenmann Posted June 15, 2015 Report Posted June 15, 2015 Glad to hear that you got it working!Did you have any possibility to open me your wiki. I will do a step by step tutorial on how to use chibistudio.We would appreciate it A LOT if you would write a guide that becomes part of the wiki. uGFX lacks a lot of "How to use" documentation which makes it difficult for beginners. Please check your mail to learn about your wiki credentials.I just need one more information. I try to compile tetris and also bubbles examples. When I compile, I have some error message regards math function (like round,sinf and sqrt) .That issue is most likely caused by missing linking to the math library. Just link to the math library (add -lm to the linker/compiler flags and you should be ready to go). If that's not it, please show us the compiler output log.~ Tectu
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now