Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Make error 'CORE_PIN0_PORTSET' was not declared in this scope

  1. #1
    Member
    Join Date
    Jan 2020
    Location
    Port Elizabeth
    Posts
    46

    Make error 'CORE_PIN0_PORTSET' was not declared in this scope

    I have been trying out Morton's make template for Teensy. https://github.com/apmorton/teensy-template
    I get the following errors(excerpt below).
    For the life of me I cannot find where these symbols are declared. I would be most grateful for some pointers that might help me solve this. For example, where is 'CORE_PIN0_PORTSET' declared?

    Sampling of the errors
    Code:
    peter@Viki:~/Arduino/teensy-template-master$ make
    -e [CXX]	src/Blink.ino
    In file included from teensy4/wiring.h:39:0,
                     from teensy4/WProgram.h:45,
                     from teensy4/Arduino.h:6,
                     from <command-line>:0:
    teensy4/core_pins.h: In function 'void digitalWriteFast(uint8_t, uint8_t)':
    teensy4/core_pins.h:1066:5: error: 'CORE_PIN0_PORTSET' was not declared in this scope
         CORE_PIN0_PORTSET = CORE_PIN0_BITMASK;
         ^
    teensy4/core_pins.h:1066:25: error: 'CORE_PIN0_BITMASK' was not declared in this scope
         CORE_PIN0_PORTSET = CORE_PIN0_BITMASK;
                             ^
    teensy4/core_pins.h:1068:5: error: 'CORE_PIN1_PORTSET' was not declared in this scope
         CORE_PIN1_PORTSET = CORE_PIN1_BITMASK;
    Makefile
    Code:
    # The name of your project (used to name the compiled .hex file)
    TARGET = $(notdir $(CURDIR))
    
    # The teensy version to use, 30, 31, 35, 36, or LC
    TEENSY = 40
    
    # Set to 24000000, 48000000, or 96000000 to set CPU core speed
    TEENSY_CORE_SPEED = 48000000
    
    # Some libraries will require this to be defined
    # If you define this, you will break the default main.cpp
    #ARDUINO = 10600
    
    # configurable options
    OPTIONS = -DUSB_SERIAL -DLAYOUT_US_ENGLISH
    
    # directory to build in
    BUILDDIR = $(abspath $(CURDIR)/build)
    
    #************************************************************************
    # Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
    # To use this makefile without Arduino, copy the resources from these
    # locations and edit the pathnames.  The rest of Arduino is not needed.
    #************************************************************************
    
    # path location for Teensy Loader, teensy_post_compile and teensy_reboot
    TOOLSPATH = $(CURDIR)/tools
    
    ifeq ($(OS),Windows_NT)
        $(error What is Win Dose?)
    else
        UNAME_S := $(shell uname -s)
        ifeq ($(UNAME_S),Darwin)
            TOOLSPATH = /Applications/Arduino.app/Contents/Java/hardware/tools/
        endif
    endif
    
    # path location for Teensy 3 core
    COREPATH = teensy4
    
    # path location for Arduino libraries
    LIBRARYPATH = libraries
    
    # path location for the arm-none-eabi compiler
    COMPILERPATH = $(TOOLSPATH)/arm/bin
    
    #************************************************************************
    # Settings below this point usually do not need to be edited
    #************************************************************************
    
    # CPPFLAGS = compiler options for C and C++
    CPPFLAGS = -Wall -g -Os -mthumb -ffunction-sections -fdata-sections -nostdlib -MMD $(OPTIONS) -DTEENSYDUINO=124 -DF_CPU=$(TEENSY_CORE_SPEED) -Isrc -I$(COREPATH)
    #CPPFLAGS = -Wall -g -O2 $(CPUOPTIONS) -MMD $(OPTIONS) -I. -ffunction-sections -fdata-sections  -Isrc -I$(COREPATH)
    
    # compiler options for C++ only
    #CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti -fpermissive
    #CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fpermissive -fno-rtti -Wno-error=narrowing
    CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fpermissive -fno-rtti -Wno-error=narrowing
    
    # compiler options for C only
    CFLAGS =
    
    # linker options
    LDFLAGS = -Os -Wl,--gc-sections -mthumb
    
    # additional libraries to link
    LIBS = -lm
    
    # compiler options specific to teensy version
    ifeq ($(TEENSY), 30)
        CPPFLAGS += -D__MK20DX128__ -mcpu=cortex-m4
        LDSCRIPT = $(COREPATH)/mk20dx128.ld
        LDFLAGS += -mcpu=cortex-m4 -T$(LDSCRIPT)
    else ifeq ($(TEENSY), 31)
        CPPFLAGS += -D__MK20DX256__ -mcpu=cortex-m4
        LDSCRIPT = $(COREPATH)/mk20dx256.ld
        LDFLAGS += -mcpu=cortex-m4 -T$(LDSCRIPT)
    else ifeq ($(TEENSY), LC)
        CPPFLAGS += -D__MKL26Z64__ -mcpu=cortex-m0plus
        LDSCRIPT = $(COREPATH)/mkl26z64.ld
        LDFLAGS += -mcpu=cortex-m0plus -T$(LDSCRIPT)
        LIBS += -larm_cortexM0l_math
    else ifeq ($(TEENSY), 35)
        CPPFLAGS += -D__MK64FX512__ -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
        LDSCRIPT = $(COREPATH)/mk64fx512.ld
        LDFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T$(LDSCRIPT)
        LIBS += -larm_cortexM4lf_math
    else ifeq ($(TEENSY), 36)
        CPPFLAGS += -D__MK66FX1M0__ -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
        LDSCRIPT = $(COREPATH)/mk66fx1m0.ld
        LDFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T$(LDSCRIPT)
        LIBS += -larm_cortexM4lf_math
    else ifeq ($(TEENSY), 40)   
        CPPFLAGS += -D__MK66FX1M0__ -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv4-sp-d16
        LDSCRIPT = $(COREPATH)/imxrt1062.ld
        LDFLAGS += -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T$(LDSCRIPT)
        LIBS += -larm_cortexM7lf_math
        LIBS += -larm_cortexM7lfsp_math -lm -lstdc++
    else
        $(error Invalid setting for TEENSY)
    endif
    
    # set arduino define if given
    ifdef ARDUINO
    	CPPFLAGS += -DARDUINO=$(ARDUINO)
    else
    	CPPFLAGS += -DUSING_MAKEFILE
    endif
    
    # names for the compiler programs
    CC = $(abspath $(COMPILERPATH))/arm-none-eabi-gcc
    CXX = $(abspath $(COMPILERPATH))/arm-none-eabi-g++
    OBJCOPY = $(abspath $(COMPILERPATH))/arm-none-eabi-objcopy
    SIZE = $(abspath $(COMPILERPATH))/arm-none-eabi-size
    
    # automatically create lists of the sources and objects
    LC_FILES := $(wildcard $(LIBRARYPATH)/*/*.c)
    LCPP_FILES := $(wildcard $(LIBRARYPATH)/*/*.cpp)
    TC_FILES := $(wildcard $(COREPATH)/*.c)
    TCPP_FILES := $(wildcard $(COREPATH)/*.cpp)
    C_FILES := $(wildcard src/*.c)
    CPP_FILES := $(wildcard src/*.cpp)
    INO_FILES := $(wildcard src/*.ino)
    
    # include paths for libraries
    L_INC := $(foreach lib,$(filter %/, $(wildcard $(LIBRARYPATH)/*/)), -I$(lib))
    
    SOURCES := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o) $(INO_FILES:.ino=.o) $(TC_FILES:.c=.o) $(TCPP_FILES:.cpp=.o) $(LC_FILES:.c=.o) $(LCPP_FILES:.cpp=.o)
    OBJS := $(foreach src,$(SOURCES), $(BUILDDIR)/$(src))
    
    all: hex
    
    build: $(TARGET).elf
    
    hex: $(TARGET).hex
    
    post_compile: $(TARGET).hex
    	@$(abspath $(TOOLSPATH))/teensy_post_compile -file="$(basename $<)" -path=$(CURDIR) -tools="$(abspath $(TOOLSPATH))"
    
    reboot:
    	@-$(abspath $(TOOLSPATH))/teensy_reboot
    
    upload: post_compile reboot
    
    $(BUILDDIR)/%.o: %.c
    	@echo -e "[CC]\t$<"
    	@mkdir -p "$(dir $@)"
    	@$(CC) $(CPPFLAGS) $(CFLAGS) $(L_INC) -o "$@" -c "$<"
    
    $(BUILDDIR)/%.o: %.cpp
    	@echo -e "[CXX]\t$<"
    	@mkdir -p "$(dir $@)"
    	@$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(L_INC) -o "$@" -c "$<"
    
    $(BUILDDIR)/%.o: %.ino
    	@echo -e "[CXX]\t$<"
    	@mkdir -p "$(dir $@)"
    	@$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(L_INC) -o "$@" -x c++ -include Arduino.h -c "$<"
    
    $(TARGET).elf: $(OBJS) $(LDSCRIPT)
    	@echo -e "[LD]\t$@"
    	@$(CC) $(LDFLAGS) -o "$@" $(OBJS) $(LIBS)
    
    %.hex: %.elf
    	@echo -e "[HEX]\t$@"
    	@$(SIZE) "$<"
    	@$(OBJCOPY) -O ihex -R .eeprom "$<" "$@"
    
    # compiler generated dependency info
    -include $(OBJS:.o=.d)
    
    clean:
    	@echo Cleaning...
    	@rm -rf "$(BUILDDIR)"
    	@rm -f "$(TARGET).elf" "$(TARGET).hex"

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,467
    Try comparing with the example Makefile

    https://github.com/PaulStoffregen/co...ensy4/Makefile

    Looks like -mfpu=fpv5-d16 and -DARDUINO_TEENSY40 may be missing or incorrect.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •