Hi all;
In the following of message posted Thu Jun 28, 2018 11:53 pm about a same subject "No rule to make target" with chibios_2.6.6. I have said that may be the problem due to the latest versions of chibios , given that chibios_2.6.6 is older version of chibistudio.
I have tried again with a latest version (chibios_18.2.1) and i have copied make file of demos of my board STM32F303 discovery into make file of my main program.
The problem remains the same, end error stays the same
Code: Select all
02:04:00 **** Incremental Build of configuration Default for project ARMCM4-STM32F303-DISCOVERY ****
make -j8 all
Makefile:266: ../../ChibiOS_18.2.1/os/common/startup/ARMCMx/compilers/GCC/rules.mk: No such file or directory
make: *** No rule to make target '../../ChibiOS_18.2.1/os/common/startup/ARMCMx/compilers/GCC/rules.mk'. Stop.
02:04:00 Build Finished (took 100ms)
I do not understand why?
Please help me.
P.S:
The full make file program with chibios_18.2.1
Code: Select all
# ChibiOS-RT project compilation, for STM32F3 Discovery Board
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -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),)
USE_LTO = yes
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
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
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 (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = rtos_demo
# Imported source files and paths
#CHIBIOS = ../..
#CHIBIOS = /Users/jleny/Software/Embedded/ChibiOS_git
CHIBIOS = ../../ChibiOS_18.2.1
#include $(CHIBIOS)/boards/ST_STM32F3_DISCOVERY/board.mk
#include $(CHIBIOS)/os/hal/platforms/STM32F30x/platform.mk
#include $(CHIBIOS)/os/hal/hal.mk
#include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F3xx/port.mk
#include $(CHIBIOS)/os/kernel/kernel.mk
#include $(CHIBIOS)/test/test.mk
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f3xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F3xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_STM32F3_DISCOVERY/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/test/lib/test.mk
include $(CHIBIOS)/test/rt/rt_test.mk
include $(CHIBIOS)/test/oslib/oslib_test.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F303xC.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
#CSRC = $(PORTSRC) \
$(KERNSRC) \
$(TESTSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/various/chprintf.c \
usbcfg.c main.c
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
$(TESTSRC) \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(ALLCPPSRC)
# 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 = $(ALLASMSRC)
ASMXSRC = $(ALLXASMSRC)
INCDIR = $(ALLINC) $(TESTINC)
#
# 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
AR = $(TRGT)ar
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 -Wundef -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
##############################################################################
##############################################################################
# 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
##############################################################################
#ifeq ($(USE_FPU),yes)
#USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant
#DDEFS += -DCORTEX_USE_FPU=TRUE
#else
#DDEFS += -DCORTEX_USE_FPU=FALSE
#endif
#ifeq ($(USE_FWLIB),yes)
#include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
# CSRC += $(STM32SRC)
#INCDIR += $(STM32INC)
#USE_OPT += -DUSE_STDPERIPH_DRIVER
#endif
##############################################################################
# Jerome: recipes for programming the board immediately after compiling
# with 'make program'
# location of OpenOCD Board .cfg files (only used with 'make program')
#OPENOCD_BOARD_DIR=/usr/local/Cellar/open-ocd/0.9.0/share/openocd/scripts/board
#OPENOCD_BOARD_DIR=$(CHIBIOS)/tools/openocd/scripts/board
# Configuration (cfg) file containing programming directives for OpenOCD
#OPENOCD_PROC_FILE=extra/stm32f3-openocd.cfg
#.PHONY: all program
#all: $(MAKE)
#program: all
#openocd -f $(OPENOCD_BOARD_DIR)/stm32f3discovery.cfg -c "program `pwd`/build/$(PROJECT).elf verify reset exit"
#openocd -f $(OPENOCD_BOARD_DIR)/stm32f3discovery.cfg -f $(OPENOCD_PROC_FILE) -c "stm_flash `pwd`/build/$(PROJECT).bin" -c shutdown
# End of user defines
##############################################################################
#include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
My main program is (I want to read the data from sensors of STM32F discovery):
Code: Select all
ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
ChibiOS/RT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
ChibiOS/RT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ch.h"
#include "hal.h"
#include "test.h"
#include "spi.h"
#include "i2c.h"
#include "usbcfg.h"
#include "chprintf.h"
#define usb_lld_connect_bus(usbp)
#define usb_lld_disconnect_bus(usbp)
/***********************/
/* LED Indicator tasks */
/***********************/
/* Red LED blinker thread, times are in milliseconds */
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
(void)arg;
msg_t dummy;
chRegSetThreadName("blinker1");
while (TRUE) {
palSetPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(2000);
palClearPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(2000);
}
return dummy;
}
/* Red LED blinker thread, times are in milliseconds */
static WORKING_AREA(waThread2, 128);
static msg_t Thread2(void *arg) {
(void)arg;
msg_t dummy;
chRegSetThreadName("blinker2");
while (TRUE) {
palClearPad(GPIOE, GPIOE_LED7_GREEN);
chThdSleepMilliseconds(50);
palSetPad(GPIOE, GPIOE_LED7_GREEN);
chThdSleepMilliseconds(50);
}
return dummy;
}
/***************************/
/* Communication protocols */
/***************************/
/* Virtual serial port over USB.*/
SerialUSBDriver SDU1;
static float mdps_per_digit = 8.75;
/* SPI: connection for L3GD20 (Gyro) */
static const SPIConfig spi1cfg = {
NULL,
/* HW dependent part.*/
GPIOE,
GPIOE_SPI1_CS,
SPI_CR1_BR_0 | SPI_CR1_BR_1 | SPI_CR1_CPOL | SPI_CR1_CPHA,
0
};
static uint8_t readByteSPI(uint8_t reg)
{
char txbuf[2] = {0x80 | reg, 0xFF};
char rxbuf[2];
spiSelect(&SPID1);
spiExchange(&SPID1, 2, txbuf, rxbuf);
spiUnselect(&SPID1);
return rxbuf[1];
}
static uint8_t writeByteSPI(uint8_t reg, uint8_t val)
{
char txbuf[2] = {reg, val};
char rxbuf[2];
spiSelect(&SPID1);
spiExchange(&SPID1, 2, txbuf, rxbuf);
spiUnselect(&SPID1);
return rxbuf[1];
}
/* I2C: connection for LSM303DLHC (Acc. + Mag.) */
static const I2CConfig i2cconfig = {
0x00902025, //voodoo magic
0,
0
};
static uint8_t readByteI2C(uint8_t addr, uint8_t reg)
{
uint8_t data;
i2cAcquireBus(&I2CD1);
(void)i2cMasterTransmitTimeout(&I2CD1, addr, ®, 1, &data, 1, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
return data;
}
static void writeByteI2C(uint8_t addr, uint8_t reg, uint8_t val)
{
uint8_t cmd[] = {reg, val};
i2cAcquireBus(&I2CD1);
(void)i2cMasterTransmitTimeout(&I2CD1, addr, cmd, 2, NULL, 0, TIME_INFINITE);
i2cReleaseBus(&I2CD1);
}
/***************************************/
/* Initializations of the MEMS sensors */
/***************************************/
static void initGyro(void)
{
/* see the L3GD20 Datasheet */
writeByteSPI(0x20, 0xcF);
}
static void initAccel(void)
{
// Highest speed, enable all axes
writeByteI2C(0x19, 0x20, 0x97);
}
static void initMag(void)
{
// Highest speed
writeByteI2C(0x1E, 0x00, 0x1C);
writeByteI2C(0x1E, 0x02, 0x00);
}
static uint8_t readGyro(float* data)
{
/* read from L3GD20 registers and assemble data */
/* 0xc0 sets read and address increment */
char txbuf[8] = {0xc0 | 0x27, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
char rxbuf[8];
spiSelect(&SPID1);
spiExchange(&SPID1, 8, txbuf, rxbuf);
spiUnselect(&SPID1);
if (rxbuf[1] & 0x7) {
int16_t val_x = (rxbuf[3] << 8) | rxbuf[2];
int16_t val_y = (rxbuf[5] << 8) | rxbuf[4];
int16_t val_z = (rxbuf[7] << 8) | rxbuf[6];
data[0] = (((float)val_x) * mdps_per_digit)/1000.0;
data[1] = (((float)val_y) * mdps_per_digit)/1000.0;
data[2] = (((float)val_z) * mdps_per_digit)/1000.0;
return 1;
}
return 0;
}
static uint8_t readAccel(float* data)
{
// setting MSB makes it increment the address for a multiple byte read
uint8_t start_reg = 0x27 | 0x80;
uint8_t out[7];
i2cAcquireBus(&I2CD1);
msg_t f = i2cMasterTransmitTimeout(&I2CD1, 0x19, &start_reg, 1, out, 7, TIME_INFINITE);
(void)f;
i2cReleaseBus(&I2CD1);
if (out[0] & 0x8) {
int16_t val_x = (out[2] << 8) | out[1];
int16_t val_y = (out[4] << 8) | out[3];
int16_t val_z = (out[6] << 8) | out[5];
// Accel scale is +- 2.0g
data[0] = ((float)val_x)*(4.0/(65535.0))*9.81;
data[1] = ((float)val_y)*(4.0/(65535.0))*9.81;
data[2] = ((float)val_z)*(4.0/(65535.0))*9.81;
return 1;
}
return 0;
}
static uint8_t readMag(float* data)
{
uint8_t start_reg = 0x03;
uint8_t out[7];
i2cAcquireBus(&I2CD1);
msg_t f = i2cMasterTransmitTimeout(&I2CD1, 0x1E, &start_reg, 1, out, 7, TIME_INFINITE);
(void)f;
i2cReleaseBus(&I2CD1);
//out[6] doesn't seem to reflect actual new data, so just push out every time
int16_t val_x = (out[0] << 8) | out[1];
int16_t val_z = (out[2] << 8) | out[3];
int16_t val_y = (out[4] << 8) | out[5];
data[0] = ((float)val_x)*1.22;
data[1] = ((float)val_y)*1.22;
data[2] = ((float)val_z)*1.22;
return 1;
}
/***************/
/* Main Thread */
/***************/
int main(void) {
halInit();
chSysInit();
/* Initializes a serial-over-USB CDC driver */
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
/* Activates the USB driver and then the USB bus pull-up on D+ */
/* Note, a delay is inserted in order to not have to disconnect the cable */
/* after a reset */
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1000);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
spiStart(&SPID1, &spi1cfg);
i2cStart(&I2CD1, &i2cconfig);
initGyro();
initAccel();
initMag();
/* Creating the blinker threads */
chThdCreateStatic(waThread1, sizeof(waThread1),
NORMALPRIO + 10, Thread1, NULL);
/*chThdCreateStatic(waThread2, sizeof(waThread2),
NORMALPRIO + 10, Thread2, NULL);
*/
while (TRUE) {
float gyroData[3];
float accelData[3];
float magData[3];
if (readGyro(gyroData) && readAccel(accelData) && readMag(magData)) {
chprintf((BaseSequentialStream *)&SDU1, "%f %f %f ", gyroData[0], gyroData[1], gyroData[2]);
chprintf((BaseSequentialStream *)&SDU1, "%f %f %f ", accelData[0], accelData[1], accelData[2]);
chprintf((BaseSequentialStream *)&SDU1, "%f %f %f\r\n", magData[0], magData[1], magData[2]);
}
chThdSleepMilliseconds(50);
}
}