Jump to content

Recommended Posts

Posted

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\ugfx

I 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=16
endif

# 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-rtti
endif

# Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif

# 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 = no
endif

# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
endif

# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
#
# 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 = 0x400
endif

# 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 = 0x400
endif

# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif

#
# Architecture or project specific options
##############################################################################

##############################################################################
# Project, sources and paths
#

SW = ..

# Define project name here
PROJECT = ch

# Imported source files and paths
CHIBIOS = ../../chibios3
GFXLIB = ../../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 board

include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk

include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk

include $(CHIBIOS)/test/rt/test.mk


LDSCRIPT= $(PORTLD)/STM32F407xG.ld

# Imported source files and paths for uGFX

include $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/board.mk
include $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.mk # The replacement ChibiOS board files
include $(GFXLIB)/gfx.mk

# Where is our source code - alter these for your project.
# Either just include the demo makefile or add your own definitions
include $(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 here
ASMSRC = $(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)gcc
CPPC = $(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)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary

# ARM-specific options here
AOPT =

# THUMB-specific options here
TOPT = -mthumb -DTHUMB

# Define C warning options here
CWARN = -Wall -Wextra -Wstrict-prototypes

# Define C++ warning options here
CPPWARN = -Wall -Wextra

#
# Compiler settings
##############################################################################

##############################################################################
# Start of default section
#

# List all default C defines here, like -D_DEBUG=1
DDEFS = $(GFXDEFS)

# List all default ASM defines here, like -D_DEBUG=1
DADEFS =

# List all default directories to look for include files here
DINCDIR =

# List the default directory to look for the libraries here
DLIBDIR =

# List all default libraries here
DLIBS =

#
# End of default section
##############################################################################

##############################################################################
# Start of user section
#

# List all user C define here, like -D_DEBUG=1
UDEFS =

# Define ASM defines here
UADEFS =

# List all user directories here
UINCDIR =

# List the user directory to look for the libraries here
ULIBDIR =

# List all user libraries here
ULIBS =

#
# End of user defines
##############################################################################


RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk

please 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 1

make: *** Waiting for unfinished jobs....

Compiling hal_queues.c

In 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
#endif

to :


#if !defined(STM32_HSECLK)
#define STM32_HSECLK 8000000U
#endif

but 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 1

make: *** 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

Posted

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.

Posted

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.

Posted

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.mk

is 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 directory

Could you please tell me witch version of chibios3 you have using ? I'll download it and try with it.

Julien

Posted

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.

Posted

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 v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html

##### Loading debugger...
Warn : Interface already configured, ignoring
Error: already specified hl_layout stlink

##### Loading CPU...
WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfg
Error: session transport was not selected. Use 'transport select '
Info : session transport was not selected, defaulting to JTAG
Error: Debug adapter doesn't support 'jtag' transport
Runtime Error: embedded:startup.tcl:20:
in procedure 'script'
at file "embedded:startup.tcl", line 58
at file "C:\ChibiStudio\ugfx\boards\base\Mikromedia-STM32-M4-ILI9341\example_chibios_2.x\openocd.cfg", line 35
at file "C:/ChibiStudio/tools/openocd//scripts/target/stm32f4x_stlink.cfg", line 2
at file "C:/ChibiStudio/tools/openocd//scripts/target/stm32f4x.cfg", line 6
in procedure 'transport' called at file "C:/ChibiStudio/tools/openocd//scripts/target/swj-dp.tcl", line 23
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 20

Posted

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.

Posted

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.

Posted

Hello,

Just to inform you it's finally working!!! :D

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 ?

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...