Page 1 of 1

Chibios and emBlocks Nightmare!

Posted: Sun Jan 03, 2016 8:47 pm
by hakko
Hello! I have been trying to port chibios 3.0.4 to emblocks but without any luck... What I have been doing is to not use direct the make files on the project and use the ide based make instead.
But sorry to say this... Chibios file organization it's a bit messy! Lot of .mk files and a segmented linker script :? . Why not to put all files related to port a single chip in one folder? I had made work chibios 2.7.6 on my target device it's a bit messy (but it works fine) too but it does not have that assembly files that 3.0.4 does... I spend one day just to discover why the assembly files give me a lot of errors! Just because it does not a file extension with a capital "S". :roll: I have tried to use the C equivalent files from the old 2.7.6 on 3.x but also unlucky... Sorry but if you want to make your project more universal please forgot assembly startup and other stuff at least for cortex Mx parts that does not need any line of assembly code btw (I know that emblocks also like to make startup asm files but I use get ride of it and make a C one). I will not post my project here because now it is a big messy messy if some one have a project template(with the necessary files) with emblocks for stm32f429 or any other stm32 I will be very thankfull! And please don't take my words as a bad thing I only wants to make this project better! And you can ask me at the end... Why don't you use our eclipse based ide? Because I alredy have around 7 ecilpse based ide's installed on my pc and I don't want more one!

Re: Chibios and emBlocks Nightmare!

Posted: Mon Jan 04, 2016 10:13 am
by Giovanni
Hi,

This person has ported the OS on em:blocks, you may ask for the template project.

viewtopic.php?f=16&t=3075&p=23770&hilit=emblocks#p23770

You can use ChibiOS on any properly configured Eclipse environment.

Giovanni

Re: Chibios and emBlocks Nightmare!

Posted: Tue Jan 12, 2016 1:03 pm
by zhu
here the template file:
EmBitz_ChibiOS_stm32_blink_template.zip
(12.97 KiB) Downloaded 256 times


detailed steps:

Startup files.
-----------------------------------------
reference:
$(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk

source files:
$(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/crt1.c
$(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/vectors.c
$(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s

include folders:
$(CHIBIOS)/os/common/ports/ARMCMx/devices/STM32F1xx
$(CHIBIOS)/os/ext/CMSIS/include
$(CHIBIOS)/os/ext/CMSIS/ST

RTOS kernel files.
-----------------------------------------
reference:
$(CHIBIOS)/os/rt/rt.mk

source files:
$(CHIBIOS)/os/rt/src/chsys.c
$(CHIBIOS)/os/rt/src/chdebug.c
$(CHIBIOS)/os/rt/src/chvt.c
$(CHIBIOS)/os/rt/src/chschd.c
$(CHIBIOS)/os/rt/src/chthreads.c
$(CHIBIOS)/os/rt/src/chtm.c
$(CHIBIOS)/os/rt/src/chstats.c
$(CHIBIOS)/os/rt/src/chdynamic.c
$(CHIBIOS)/os/rt/src/chregistry.c
$(CHIBIOS)/os/rt/src/chsem.c
$(CHIBIOS)/os/rt/src/chmtx.c
$(CHIBIOS)/os/rt/src/chcond.c
$(CHIBIOS)/os/rt/src/chevents.c
$(CHIBIOS)/os/rt/src/chmsg.c
$(CHIBIOS)/os/rt/src/chmboxes.c
$(CHIBIOS)/os/rt/src/chqueues.c
$(CHIBIOS)/os/rt/src/chmemcore.c
$(CHIBIOS)/os/rt/src/chheap.c
$(CHIBIOS)/os/rt/src/chmempools.c

include folders:
$(CHIBIOS)/os/rt/include

RTOS kernel stm32 port files.
-----------------------------------------
reference:
$(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk

source files:
$(CHIBIOS)/os/rt/ports/ARMCMx/chcore.c
$(CHIBIOS)/os/rt/ports/ARMCMx/chcore_v7m.c
$(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s

include folders:
$(CHIBIOS)/os/rt/ports/ARMCMx
$(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC

OSAL files.
-----------------------------------------
reference:
$(CHIBIOS)/os/hal/osal/rt/osal.mk

source files:
${CHIBIOS}/os/hal/osal/rt/osal.c

include folders:
${CHIBIOS}/os/hal/osal/rt

HAL files.
-----------------------------------------
reference:
$(CHIBIOS)/os/hal/hal.mk

source files:
$(CHIBIOS)/os/hal/src/hal.c
$(CHIBIOS)/os/hal/src/hal_queues.c
$(CHIBIOS)/os/hal/src/hal_mmcsd.c
$(CHIBIOS)/os/hal/src/adc.c
$(CHIBIOS)/os/hal/src/can.c
$(CHIBIOS)/os/hal/src/dac.c
$(CHIBIOS)/os/hal/src/ext.c
$(CHIBIOS)/os/hal/src/gpt.c
$(CHIBIOS)/os/hal/src/i2c.c
$(CHIBIOS)/os/hal/src/i2s.c
$(CHIBIOS)/os/hal/src/icu.c
$(CHIBIOS)/os/hal/src/mac.c
$(CHIBIOS)/os/hal/src/mmc_spi.c
$(CHIBIOS)/os/hal/src/pal.c
$(CHIBIOS)/os/hal/src/pwm.c
$(CHIBIOS)/os/hal/src/rtc.c
$(CHIBIOS)/os/hal/src/sdc.c
$(CHIBIOS)/os/hal/src/serial.c
$(CHIBIOS)/os/hal/src/serial_usb.c
$(CHIBIOS)/os/hal/src/spi.c
$(CHIBIOS)/os/hal/src/st.c
$(CHIBIOS)/os/hal/src/uart.c
$(CHIBIOS)/os/hal/src/usb.c

include folders:
$(CHIBIOS)/os/hal/include


stm32 platform files.
-----------------------------------------
reference:
$(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk

source files:
$(CHIBIOS)/os/hal/ports/common/ARMCMx/nvic.c
$(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/stm32_dma.c
$(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/hal_lld.c
$(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/adc_lld.c
$(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/ext_lld_isr.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/can_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/ext_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/mac_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/sdc_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/DACv1/dac_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/GPIOv1/pal_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/SPIv1/spi_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/pwm_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/st_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/USARTv1/uart_lld.c
$(CHIBIOS)/os/hal/ports/STM32/LLD/USBv1/usb_lld.c

include folders:
$(CHIBIOS)/os/hal/ports/common/ARMCMx
$(CHIBIOS)/os/hal/ports/STM32/STM32F1xx
$(CHIBIOS)/os/hal/ports/STM32/LLD
$(CHIBIOS)/os/hal/ports/STM32/LLD/DACv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/GPIOv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/I2Cv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/RTCv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/SPIv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/USARTv1
$(CHIBIOS)/os/hal/ports/STM32/LLD/USBv1


board files.
-----------------------------------------
source files:
$(your_board)/board.c

include folders:
$(your_board)

project build options
-----------------------------------------
1.Device set "cortext-m3"
2.Link script set "$(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/ld/stm32f103x8.ld"
3.Linker settings > Linker symbols add "__process_stack_size__=0x400" and "__main_stack_size__=0x400"
4.Assembler settings > Assembler Flags > Others set "-x assembler-with-cpp"
5.Search directories > includes add "above include folders"
6.Search directories > Linker add "$(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/ld"

device.png

assembler.png


note: all of those could found in ChibiOS demo's Makefile and rules.mk files.

done!

Zhu