Not using correct header

Discussions and support about ChibiStudio, the free development environment for ARM.
Tabulous
Posts: 421
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 1 time
Been thanked: 10 times

Not using correct header

Postby Tabulous » Tue Feb 07, 2017 2:55 pm

Target STM32F411

board.h defined like this
/*
* MCU type as defined in the ST header.
*/
#define STM32F411xE


as you can see the correct header file is not used and also the error is never shown.......

Untitled.jpg

Tabulous
Posts: 421
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 1 time
Been thanked: 10 times

Re: Not using correct header

Postby Tabulous » Tue Feb 07, 2017 3:27 pm

Tabulous wrote:Target STM32F411

board.h defined like this
/*
* MCU type as defined in the ST header.
*/
#define STM32F411xE


as you can see the correct header file is not used and also the error is never shown.......

Untitled.jpg


PS ive tried rebuilding the Index

User avatar
RoccoMarco
Posts: 557
Joined: Wed Apr 24, 2013 4:11 pm
Location: Salerno (Italy)
Has thanked: 65 times
Been thanked: 50 times
Contact:

Re: Not using correct header

Postby RoccoMarco » Tue Feb 07, 2017 3:35 pm

Hi,
is it a custom demo or an official one?
Can you share board.h and makefile?

Please wrap them in code tag.
Ciao,
RM

Tabulous
Posts: 421
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 1 time
Been thanked: 10 times

Re: Not using correct header

Postby Tabulous » Tue Feb 07, 2017 3:44 pm

RoccoMarco wrote:Hi,
is it a custom demo or an official one?
Can you share board.h and makefile?

Please wrap them in code tag.


Its custom board

Code: Select all

/*
    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

#ifndef _BOARD_H_
#define _BOARD_H_

/*
 * Setup for Test board.
 */

/*
 * Board identifier.
 */
#define BOARD_TG_T721121601
#define BOARD_NAME                  "Test"

/*
 * Board oscillators-related settings.
 * NOTE: HSE not fitted.
 */
#if !defined(STM32_LSECLK)
#define STM32_LSECLK                32768U
#endif

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

/*
 * Board voltages.
 * Required for performance limits calculation.
 */
#define STM32_VDD                   300U

/*
 * MCU type as defined in the ST header.
 */
#define STM32F411xE

/*
 * IO pins assignments.
 */


board.mk

Code: Select all

# List of all the board related files.
BOARDSRC = ${CHIBIOS}/os/hal/boards/TG_T721121601/board.c

# Required include directories
BOARDINC = ${CHIBIOS}/os/hal/boards/TG_T721121601


makefile

Code: Select all

##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#

# Compiler options here.
ifeq ($(USE_OPT),)
  USE_OPT = -O0 -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
  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

# 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 on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
  USE_FPU = no
endif

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

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

# Define project name here
PROJECT = t7_app

# Imported source files and paths
CHIBIOS = ../../..
# Startup files.
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/boards/TG_T721121601/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
#include $(CHIBIOS)/test/rt/test.mk

# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F411xC_T7APP.ld

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(STARTUPSRC) \
       $(KERNSRC) \
       $(PORTSRC) \
       $(OSALSRC) \
       $(HALSRC) \
       $(PLATFORMSRC) \
       $(BOARDSRC) \
       $(CHIBIOS)/os/various/syscalls.c \
       $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
       $(CHIBIOS)/os/hal/lib/streams/memstreams.c \
       main.c cdc.c debug.c shell.c vt100.c usbcfg.c \
       gnss.c except.c console.c modem.c athandler.c \
       als.c psu.c ble.c imu.c flash.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) \
         $(CHIBIOS)/os/hal/lib/streams \
         $(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
AR   = $(TRGT)ar
OD   = $(TRGT)objdump
SZ   = $(TRGT)size
HEX  = $(CP) -O ihex
BIN  = $(CP) -O binary
US   = binsize 128 256 build\\t7_app.elf

# 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 = -lm

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

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

User avatar
Giovanni
Site Admin
Posts: 10220
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 212 times
Been thanked: 197 times
Contact:

Re: Not using correct header

Postby Giovanni » Tue Feb 07, 2017 4:37 pm

Is that a compilation error or just an Eclipse quirk? if it is related to Eclipse try erasing discovered paths, recompile and reindex.

Giovanni

Tabulous
Posts: 421
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 1 time
Been thanked: 10 times

Re: Not using correct header

Postby Tabulous » Wed Feb 08, 2017 11:12 am

Giovanni wrote:Is that a compilation error or just an Eclipse quirk? if it is related to Eclipse try erasing discovered paths, recompile and reindex.

Giovanni


Everything compiles ok(i think, well it seems to work), but normally you can press F3 when on a SYSTEM define and it will jump to the header file.

Well what it is doing is jumping to the wrong header file.

i.e. I highlight SPI_CR1_BR_0 in source file and press F3, it should jump to stm32f411xe.h header, but it doesn't, it jump to stm32l486xx.h.



Ive tried to clear the discoverable paths in properties -> C/C++ Build "Discovery Options" and then re-build the index, but still the same.

User avatar
Giovanni
Site Admin
Posts: 10220
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 212 times
Been thanked: 197 times
Contact:

Re: Not using correct header

Postby Giovanni » Wed Feb 08, 2017 11:46 am

It is eclipse getting confused by the multiple headers in the same directory. I think we cannot address it, you may remove unrelated headers from your source tree.

Giovanni


Return to “ChibiStudio”

Who is online

Users browsing this forum: No registered users and 1 guest