Help us understand the problem. What is going on with this article?

stm32f4-discoveryの作法 その11

More than 1 year has passed since last update.

概要

stm32f4-discoveryの作法、調べてみた。
toppers sspをmakeしてみた。

結果

TOPPERS/SSP Kernel 1.1.1  for CQ-STARM(STM32F103) (Mar 31 2019 , 07:47:26)
Copyright (C) 2010 by Meika Sugimoto
Copyright (C) 2010 by Naoki Saito
            Nagoya Municipal Industrial Research Institute, JAPAN

Sample program starts.
#act_tsk(0)
task1 is running (001).   |
task1 is running (002).   |
task1 is running (003).   |
task1 is running (004).   |
task1 is running (005).   |
task1 is running (006).   |
task1 is running (007).   |
task1 is running (008).   |
task1 is running (009).   |
task1 is running (010).   |
task1 is running (011).   |
task1 is running (012).   |
task1 is running (013).   |
task1 is running (014).   |
#1#ext_tsk()
#sta_alm(1, 5000)
#stp_alm(1)
#act_tsk(1)
task2 is running (015).     +
task2 is running (016).     +
task2 is running (017).     +
task2 is running (018).     +
task2 is running (019).     +
task2 is running (020).     +
task2 is running (021).     +
#2#ext_tsk()

使用したライブラリー

https://github.com/ohisama/toppers_ssp_stm32f4_discovery

MakeFile

all:
TARGET = stm32f4_discovery_gcc
SRCLANG = c
ifeq ($(SRCLANG),c++)
  USE_CXX = true
  CXXLIBS = -lstdc++ -lm -lc
  CXXRTS = cxxrt.o newlibrt.o
endif
SRCDIR = .
OBJEXT = 
DBGENV := 
KERNEL_LIB = 
KERNEL_FUNCOBJS = 
ENABLE_TRACE = 
PERL = /usr/bin/perl
CFG = ./cfg/cfg
OBJNAME = ssp1
ifdef OBJEXT
  OBJFILE = $(OBJNAME).$(OBJEXT)
  CFG1_OUT = cfg1_out.$(OBJEXT)
else
  OBJFILE = $(OBJNAME)
  CFG1_OUT = cfg1_out
endif
TARGETDIR = $(SRCDIR)/target/$(TARGET)
include $(TARGETDIR)/Makefile.target
-include Makefile.config
CFG_TABS := --api-table $(SRCDIR)/kernel/ssp_kernel_api.csv \
            --cfg1-def-table $(SRCDIR)/kernel/ssp_kernel_def.csv \
            --cfg1-def-table $(SRCDIR)/syssvc/syssvc_def.csv $(CFG_TABS)
CFG_OBJS := kernel_cfg.o $(CFG_OBJS)
CFG2_OUT := kernel_cfg.c kernel_cfg.h $(CFG2_OUT)
COPTS := $(COPTS) -g
ifndef OMIT_WARNING_ALL
  COPTS := $(COPTS) -Wall
endif
ifndef OMIT_OPTIMIZATION
  COPTS := $(COPTS) -Os
endif
CDEFS := $(CDEFS)
INCLUDES := -I. -I$(SRCDIR)/include -I$(SRCDIR)/arch -I$(SRCDIR) $(INCLUDES)
LDFLAGS := $(LDFLAGS)
LIBS := $(LIBS) $(CXXLIBS)
CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES)
APPLNAME = sample2
APPLDIR = 
APPL_CFG = $(APPLNAME).cfg
APPL_DIR = $(APPLDIR)
APPL_ASMOBJS =
ifdef USE_CXX
  APPL_CXXOBJS = $(APPLNAME).o 
  APPL_COBJS =
else
  APPL_COBJS = $(APPLNAME).o 
endif
APPL_CFLAGS =
APPL_LIBS =
ifdef APPLDIR
  INCLUDES := $(INCLUDES) $(foreach dir,$(APPLDIR),-I$(dir))
endif
SYSSVC_DIR := $(SYSSVC_DIR) $(SRCDIR)/syssvc $(SRCDIR)/library
SYSSVC_ASMOBJS := $(SYSSVC_ASMOBJS)
SYSSVC_COBJS := $(SYSSVC_COBJS) banner.o serial.o vasyslog.o syslog.o log_output.o logtask.o
SYSSVC_CFLAGS := $(SYSSVC_CFLAGS)
SYSSVC_LIBS := $(SYSSVC_LIBS)
INCLUDES := $(INCLUDES)
EXTPKG_DIR := $(EXTPKG_DIR) $(SRCDIR)/extension
KERNEL_DIR := $(KERNEL_DIR) $(SRCDIR)/kernel
KERNEL_ASMOBJS := $(KERNEL_ASMOBJS)
KERNEL_COBJS := $(KERNEL_COBJS)
KERNEL_CFLAGS := $(KERNEL_CFLAGS) -I$(SRCDIR)/kernel -I$(EXTPKG_DIR)
#all: $(OBJFILE)
all: $(OBJNAME).bin
#all: $(OBJNAME).srec
ifdef DBGENV
  CDEFS := $(CDEFS) -D$(DBGENV)
endif
ifdef KERNEL_LIB
  LIBKERNEL = $(KERNEL_LIB)/libkernel.a
else
  LIBKERNEL = libkernel.a
endif
include $(SRCDIR)/kernel/Makefile.kernel
ifdef KERNEL_FUNCOBJS
  KERNEL_LCSRCS := $(KERNEL_FCSRCS)
  KERNEL_LCOBJS := $(foreach file,$(KERNEL_FCSRCS),$($(file:.c=)))
else
  KERNEL_CFLAGS := -DALLFUNC $(KERNEL_CFLAGS)
  KERNEL_COBJS := $(KERNEL_COBJS) \
                    $(foreach file,$(KERNEL_FCSRCS),$(file:.c=.o))
endif
vpath %.c $(KERNEL_DIR) $(SYSSVC_DIR) $(APPL_DIR) $(EXTPKG_DIR)
vpath %.S $(KERNEL_DIR) $(SYSSVC_DIR) $(APPL_DIR) $(EXTPKG_DIR)
KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS)
SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS)
APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
ALL_OBJS = $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
                                            $(END_OBJS) $(HIDDEN_OBJS)
ALL_LIBS = $(APPL_LIBS) $(SYSSVC_LIBS) $(LIBKERNEL) $(LIBS)
ifdef TEXT_START_ADDRESS
  LDFLAGS := $(LDFLAGS) -Wl,-Ttext,$(TEXT_START_ADDRESS)
endif
ifdef DATA_START_ADDRESS
  LDFLAGS := $(LDFLAGS) -Wl,-Tdata,$(DATA_START_ADDRESS)
endif
ifdef LDSCRIPT
  LDFLAGS := $(LDFLAGS) -T $(LDSCRIPT)
endif
cfg1_out.c:
    $(CFG) --pass 1 --kernel ssp $(INCLUDES) $(CFG_TABS) $(APPL_CFG)
kernel_cfg.timestamp: $(START_OBJS) cfg1_out.o $(END_OBJS) $(HIDDEN_OBJS)
kernel_cfg.timestamp $(CFG2_OUT):
    $(LINK) $(CFLAGS) $(LDFLAGS) $(CFG1_OUT_LDFLAGS) -o $(CFG1_OUT) \
                        $(START_OBJS) cfg1_out.o $(END_OBJS)
    $(NM) -C $(CFG1_OUT) > cfg1_out.syms
    $(OBJCOPY) -O srec -S $(CFG1_OUT) cfg1_out.srec
    $(CFG) --pass 2 --kernel ssp $(INCLUDES) \
                -T $(TARGETDIR)/target.tf $(CFG_TABS) $(APPL_CFG)
    touch kernel_cfg.timestamp
libkernel.a: $(KERNEL_LIB_OBJS)
    rm -f libkernel.a
    $(AR) -rcs libkernel.a $(KERNEL_LIB_OBJS)
    $(RANLIB) libkernel.a
banner.o: kernel_cfg.timestamp $(filter-out banner.o,$(ALL_OBJS)) \
                                            $(filter %.a,$(ALL_LIBS))
$(OBJFILE): kernel_cfg.timestamp $(ALL_OBJS) $(filter %.a,$(ALL_LIBS))
    $(LINK) $(CFLAGS) $(LDFLAGS) -o $(OBJFILE) $(START_OBJS) \
            $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) $(ALL_LIBS) $(END_OBJS)
    $(NM) -C $(OBJFILE) > $(OBJNAME).syms
    $(OBJCOPY) -O srec -S $(OBJFILE) $(OBJNAME).srec
    $(CFG) --pass 3 --kernel ssp $(INCLUDES) \
                --rom-image $(OBJNAME).srec --symbol-table $(OBJNAME).syms \
                -T $(TARGETDIR)/target_check.tf $(CFG_TABS) $(APPL_CFG)
$(OBJNAME).bin: $(OBJFILE)
    $(OBJCOPY) -O binary -S $(OBJFILE) $(OBJNAME).bin
$(OBJNAME).srec: $(OBJFILE)
    $(OBJCOPY) -O srec -S $(OBJFILE) $(OBJNAME).srec
.PHONY: clean
clean:
    rm -f \#* *~ *.o $(CLEAN_FILES)
    rm -f $(OBJFILE) $(OBJNAME).syms $(OBJNAME).srec $(OBJNAME).bin
    rm -f kernel_cfg.timestamp $(CFG2_OUT)
    rm -f cfg1_out.c $(CFG1_OUT) cfg1_out.syms cfg1_out.srec
ifndef KERNEL_LIB
    rm -f $(LIBKERNEL)
endif
    rm -f makeoffset.s offset.h
    rm -f Makefile.config
.PHONY: cleankernel
cleankernel:
    rm -rf $(KERNEL_LIB_OBJS)
    rm -f makeoffset.s offset.h
.PHONY: cleandep
cleandep:
    if ! [ -f Makefile.depend ]; then \
        rm -f kernel_cfg.timestamp $(CFG2_OUT); \
        rm -f cfg1_out.c cfg1_out.o $(CFG1_OUT) cfg1_out.syms cfg1_out.srec; \
        rm -f makeoffset.s offset.h; \
    fi
    rm -f Makefile.depend
.PHONY: realclean
realclean: cleandep clean
ifneq ($(REALCLEAN_FILES),)
    rm -f $(REALCLEAN_FILES)
endif
KERNEL_CFG_CFLAGS = $(APPL_CFLAGS) $(SYSSVC_CFLAGS) $(KERNEL_CFLAGS)
kernel_cfg.o cfg1_out.o : %.o: %.c
    $(CC) -c $(CFLAGS) $(KERNEL_CFG_CFLAGS) $<
kernel_cfg.s cfg1_out.s : %.s: %.c
    $(CC) -S $(CFLAGS) $(KERNEL_CFG_CFLAGS) $<
kernel_cfg.d cfg1_out.d : %.d: %.c
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(KERNEL_CFG_CFLAGS)" $< >> Makefile.depend
cfg1_out.depend:
    @$(CFG) -M cfg1_out.c $(INCLUDES) $(APPL_CFG) >> Makefile.depend
makeoffset.d: makeoffset.c
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -T "makeoffset.s" -O "$(CFLAGS) $(KERNEL_CFLAGS)" $< >> Makefile.depend
.PHONY: gendepend
gendepend:
    @echo "Generating Makefile.depend."
.PHONY: depend
ifdef KERNEL_LIB
depend: cleandep kernel_cfg.timestamp gendepend \
        cfg1_out.depend cfg1_out.d \
        $(ALL_OBJS:.o=.d)
else
depend: cleandep kernel_cfg.timestamp gendepend \
        cfg1_out.depend cfg1_out.d \
        $(KERNEL_AUX_COBJS:.o=.d) $(KERNEL_ASMOBJS:.o=.d) \
        $(KERNEL_COBJS:.o=.d) $(KERNEL_LCSRCS:.c=.d) $(ALL_OBJS:.o=.d)
endif
-include Makefile.depend
ifeq ($(TOOL),gcc)
  ifdef GCC_TARGET
    GCC_TARGET_PREFIX = /home/ore/arm-2010q1/bin/arm-none-eabi-
  endif
  CC = $(GCC_TARGET_PREFIX)gcc
  CXX = $(GCC_TARGET_PREFIX)g++
  AS = $(GCC_TARGET_PREFIX)as
  LD = $(GCC_TARGET_PREFIX)ld
  AR = $(GCC_TARGET_PREFIX)ar
  NM = $(GCC_TARGET_PREFIX)nm
  RANLIB = $(GCC_TARGET_PREFIX)ranlib
  OBJCOPY = $(GCC_TARGET_PREFIX)objcopy
  OBJDUMP = $(GCC_TARGET_PREFIX)objdump
endif
ifdef USE_CXX
  LINK = $(CXX)
else
  LINK = $(CC)
endif
KERNEL_ALL_COBJS = $(KERNEL_COBJS) $(KERNEL_AUX_COBJS)
$(KERNEL_ALL_COBJS): %.o: %.c
    $(CC) -c $(CFLAGS) $(KERNEL_CFLAGS) $<
$(KERNEL_ALL_COBJS:.o=.s): %.s: %.c
    $(CC) -S $(CFLAGS) $(KERNEL_CFLAGS) $<
$(KERNEL_LCOBJS): %.o:
    $(CC) -DTOPPERS_$(*F) -o $@ -c $(CFLAGS) $(KERNEL_CFLAGS) $<
$(KERNEL_LCOBJS:.o=.s): %.s:
    $(CC) -DTOPPERS_$(*F) -o $@ -S $(CFLAGS) $(KERNEL_CFLAGS) $<
$(KERNEL_ASMOBJS): %.o: %.S
    $(CC) -c $(CFLAGS) $(KERNEL_CFLAGS) $<
$(SYSSVC_COBJS): %.o: %.c
    $(CC) -c $(CFLAGS) $(SYSSVC_CFLAGS) $<
$(SYSSVC_COBJS:.o=.s): %.s: %.c
    $(CC) -S $(CFLAGS) $(SYSSVC_CFLAGS) $<
$(SYSSVC_ASMOBJS): %.o: %.S
    $(CC) -c $(CFLAGS) $(SYSSVC_CFLAGS) $<
$(APPL_COBJS): %.o: %.c
    $(CC) -c $(CFLAGS) $(APPL_CFLAGS) $<
$(APPL_COBJS:.o=.s): %.s: %.c
    $(CC) -S $(CFLAGS) $(APPL_CFLAGS) $<
$(APPL_CXXOBJS): %.o: %.cpp
    $(CXX) -c $(CFLAGS) $(APPL_CFLAGS) $<
$(APPL_CXXOBJS:.o=.s): %.s: %.cpp
    $(CXX) -S $(CFLAGS) $(APPL_CFLAGS) $<
$(APPL_ASMOBJS): %.o: %.S
    $(CC) -c $(CFLAGS) $(APPL_CFLAGS) $<
$(KERNEL_COBJS:.o=.d): %.d: %.c
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(KERNEL_CFLAGS)" $< >> Makefile.depend
$(KERNEL_LCSRCS:.c=.d): %.d: %.c
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) -T "$($*)" \
        -O "-DALLFUNC $(CFLAGS) $(KERNEL_CFLAGS)" $< >> Makefile.depend
$(KERNEL_ASMOBJS:.o=.d): %.d: %.S
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(KERNEL_CFLAGS)" $< >> Makefile.depend
$(SYSSVC_COBJS:.o=.d): %.d: %.c
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(SYSSVC_CFLAGS)" $< >> Makefile.depend
$(SYSSVC_ASMOBJS:.o=.d): %.d: %.S
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(SYSSVC_CFLAGS)" $< >> Makefile.depend
$(APPL_COBJS:.o=.d): %.d: %.c
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(APPL_CFLAGS)" $< >> Makefile.depend
$(APPL_CXXOBJS:.o=.d): %.d: %.cpp
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CXX) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(APPL_CFLAGS)" $< >> Makefile.depend
$(APPL_ASMOBJS:.o=.d): %.d: %.S
    @$(PERL) $(SRCDIR)/utils/makedep -C $(CC) $(MAKEDEP_OPTS) \
        -O "$(CFLAGS) $(APPL_CFLAGS)" $< >> Makefile.depend
%.o: %.c
    @echo "*** Default compile rules should not be used."
    $(CC) -c $(CFLAGS) $<
%.s: %.c
    @echo "*** Default compile rules should not be used."
    $(CC) -S $(CFLAGS) $<
%.o: %.cpp
    @echo "*** Default compile rules should not be used."
    $(CXX) -c $(CFLAGS) $<
%.s: %.cpp
    @echo "*** Default compile rules should not be used."
    $(CXX) -S $(CFLAGS) $<
%.o: %.S
    @echo "*** Default compile rules should not be used."
    $(CC) -c $(CFLAGS) $<

シリアル接続

115200
pb6 rx
pb7 tx

以上。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした