Skip to content

Commit fc955e6

Browse files
committed
Added my_app and my_lib as part of the main repository
1 parent 70b6460 commit fc955e6

25 files changed

+4096
-4
lines changed

.gitignore

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
Makefile
2-
build
3-
/sample_defs
4-
.DS_Store
1+
# Ignore build artifacts
2+
build/
3+
*.o
4+
*.so
5+
6+
# Ignore logs and temporary files
7+
*.log
8+
*.tmp
9+
*.swp
10+

Makefile

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
#
2+
# Core Flight Software CMake / GNU make wrapper
3+
#
4+
# ABOUT THIS MAKEFILE:
5+
# It is a GNU-make wrapper that calls the CMake tools appropriately
6+
# so that setting up a new build is fast and easy with no need to
7+
# learn the CMake commands. It also makes it easier to integrate
8+
# the build with IDE tools such as Eclipse by providing a default
9+
# makefile that has the common targets such as all/clean/etc.
10+
#
11+
# Use of this file is optional.
12+
#
13+
# This file is intended to be placed at the TOP-MOST level of the mission
14+
# source tree, i.e. a level above "cfe". Note this is outside the cfe
15+
# repository which is why it cannot be delivered directly in place.
16+
# To use it, simply copy it to the top directory. As this just contains
17+
# wrappers for the CMake targets, it is unlikely to change. Projects
18+
# are also free to customize this file and add their own targets after
19+
# copying it to the top of the source tree.
20+
#
21+
# For _ALL_ targets defined in this file the build tree location may
22+
# be specified via the "O" variable (i.e. make O=<my-build-dir> all).
23+
# If not specified then the "build" subdirectory will be assumed.
24+
#
25+
# This wrapper defines the following major targets:
26+
# prep -- Runs CMake to create a new or re-configure an existing build tree
27+
# Note that multiple build trees can exist from a single source
28+
# Other control options (such as "SIMULATION") may be passed to CMake via
29+
# make variables depending on the mission build scripts. These will be
30+
# cached in the build tree so they do not need to be set again thereafter.
31+
#
32+
# all -- Build all targets in the CMake build tree
33+
#
34+
# install -- Copy all files to the installation tree and run packaging scripts
35+
# The "DESTDIR" environment variable controls where the files are copied
36+
#
37+
# clean -- Clean all targets in the CMake build tree, but not the build tree itself.
38+
#
39+
# distclean -- Entirely remove the build directory specified by "O"
40+
# Note that after this the "prep" step must be run again in order to build.
41+
# Use caution with this as it does an rm -rf - don't set O to your home dir!
42+
#
43+
# doc -- Build all doxygen source documentation. The HTML documentation will be
44+
# generated under the build tree specified by "O".
45+
#
46+
# usersguide -- Build all API/Cmd/Tlm doxygen documentation. The HTML documentation
47+
# will be generated under the build tree specified by "O".
48+
#
49+
# osalguide -- Build OSAL API doxygen documentation. The HTML documentation will
50+
# be generated under the build tree specified by "O".
51+
#
52+
# test -- Run all unit tests defined in the build. Unit tests will typically only
53+
# be executable when building with the "SIMULATION=native" option. Otherwise
54+
# it is up to the user to copy the executables to the target and run them.
55+
#
56+
# lcov -- Runs the "lcov" tool on the build tree to collect all code coverage
57+
# analysis data and build the reports. Code coverage data may be output by
58+
# the "make test" target above.
59+
#
60+
61+
# Establish default values for critical variables. Any of these may be overridden
62+
# on the command line or via the make environment configuration in an IDE
63+
O ?= build
64+
ARCH ?= native/default_cpu1
65+
BUILDTYPE ?= debug
66+
INSTALLPREFIX ?= /exe
67+
DESTDIR ?= $(O)
68+
69+
# The "DESTDIR" variable is a bit more complicated because it should be an absolute
70+
# path for CMake, but we want to accept either absolute or relative paths. So if
71+
# the path does NOT start with "/", prepend it with the current directory.
72+
ifeq ($(filter /%, $(DESTDIR)),)
73+
DESTDIR := $(CURDIR)/$(DESTDIR)
74+
endif
75+
76+
# The "LOCALTGTS" defines the top-level targets that are implemented in this makefile
77+
# Any other target may also be given, in that case it will simply be passed through.
78+
LOCALTGTS := doc usersguide osalguide prep all clean install distclean test lcov
79+
OTHERTGTS := $(filter-out $(LOCALTGTS),$(MAKECMDGOALS))
80+
81+
# As this makefile does not build any real files, treat everything as a PHONY target
82+
# This ensures that the rule gets executed even if a file by that name does exist
83+
.PHONY: $(LOCALTGTS) $(OTHERTGTS)
84+
85+
# If the target name appears to be a directory (ends in /), do a make all in that directory
86+
DIRTGTS := $(filter %/,$(OTHERTGTS))
87+
ifneq ($(DIRTGTS),)
88+
$(DIRTGTS):
89+
$(MAKE) -C $(O)/$(patsubst $(O)/%,%,$(@)) all
90+
endif
91+
92+
# For any other goal that is not one of the known local targets, pass it to the arch build
93+
# as there might be a target by that name. For example, this is useful for rebuilding
94+
# single unit test executable files while debugging from the IDE
95+
FILETGTS := $(filter-out $(DIRTGTS),$(OTHERTGTS))
96+
ifneq ($(FILETGTS),)
97+
$(FILETGTS):
98+
$(MAKE) -C $(O)/$(ARCH) $(@)
99+
endif
100+
101+
# The "prep" step requires extra options that are specified via environment variables.
102+
# Certain special ones should be passed via cache (-D) options to CMake.
103+
# These are only needed for the "prep" target but they are computed globally anyway.
104+
PREP_OPTS :=
105+
106+
ifneq ($(INSTALLPREFIX),)
107+
PREP_OPTS += -DCMAKE_INSTALL_PREFIX=$(INSTALLPREFIX)
108+
endif
109+
110+
ifneq ($(VERBOSE),)
111+
PREP_OPTS += --trace
112+
endif
113+
114+
ifneq ($(BUILDTYPE),)
115+
PREP_OPTS += -DCMAKE_BUILD_TYPE=$(BUILDTYPE)
116+
endif
117+
118+
ifneq ($(CMAKE_PREFIX_PATH),)
119+
PREP_OPTS += -DCMAKE_PREFIX_PATH=$(CMAKE_PREFIX_PATH)
120+
endif
121+
122+
all:
123+
$(MAKE) --no-print-directory -C "$(O)" mission-all
124+
125+
install:
126+
$(MAKE) --no-print-directory -C "$(O)" DESTDIR="$(DESTDIR)" mission-install
127+
128+
prep $(O)/.prep:
129+
mkdir -p "$(O)"
130+
(cd "$(O)" && cmake $(PREP_OPTS) "$(CURDIR)/cfe")
131+
echo "$(PREP_OPTS)" > "$(O)/.prep"
132+
133+
clean:
134+
$(MAKE) --no-print-directory -C "$(O)" mission-clean
135+
136+
distclean:
137+
rm -rf "$(O)"
138+
139+
# Grab lcov baseline before running tests
140+
test:
141+
lcov --capture --initial --directory $(O)/$(ARCH) --output-file $(O)/$(ARCH)/coverage_base.info
142+
(cd $(O)/$(ARCH) && ctest -O ctest.log)
143+
144+
lcov:
145+
lcov --capture --rc lcov_branch_coverage=1 --directory $(O)/$(ARCH) --output-file $(O)/$(ARCH)/coverage_test.info
146+
lcov --rc lcov_branch_coverage=1 --add-tracefile $(O)/$(ARCH)/coverage_base.info --add-tracefile $(O)/$(ARCH)/coverage_test.info --output-file $(O)/$(ARCH)/coverage_total.info
147+
genhtml $(O)/$(ARCH)/coverage_total.info --branch-coverage --output-directory $(O)/$(ARCH)/lcov
148+
@/bin/echo -e "\n\nCoverage Report Link: file:$(CURDIR)/$(O)/$(ARCH)/lcov/index.html\n"
149+
150+
doc:
151+
$(MAKE) --no-print-directory -C "$(O)" mission-doc
152+
153+
usersguide:
154+
$(MAKE) --no-print-directory -C "$(O)" cfe-usersguide
155+
156+
osalguide:
157+
$(MAKE) --no-print-directory -C "$(O)" osal-apiguide
158+
159+
# Make all the commands that use the build tree depend on a flag file
160+
# that is used to indicate the prep step has been done. This way
161+
# the prep step does not need to be done explicitly by the user
162+
# as long as the default options are sufficient.
163+
$(filter-out prep distclean,$(LOCALTGTS)): $(O)/.prep

apps/my_app

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit ceaf7ab5fadc7ac80f9bee6f5a2757593417e461

libs/my_lib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 83d26957beaf256bbcdff3188a67dc4025726704
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Example arch_build_custom.cmake
3+
# -------------------------------
4+
#
5+
# This file will be automatically included in the arch-specific build scope
6+
#
7+
# Definitions and options specified here will be used when cross-compiling
8+
# _all_ FSW code for _all_ targets defined in targets.cmake.
9+
#
10+
# Avoid machine-specific code generation options in this file (e.g. -f,-m options); such
11+
# options should be localized to the toolchain file such that they will only be
12+
# included on the machines where they apply.
13+
#
14+
# CAUTION: In heterogeneous environments where different cross compilers are
15+
# used for different CPUs, particularly if from different vendors, it is likely
16+
# that compile options will need to be different as well.
17+
#
18+
# In general, options in this file can only be used in cases where all CPUs use a
19+
# compiler from the same vendor and/or are all GCC based such that they accept similar
20+
# command line options.
21+
#
22+
# This file can alternatively be named as "arch_build_custom_${TARGETSYSTEM}.cmake"
23+
# where ${TARGETSYSTEM} represents the system type, matching the toolchain.
24+
#
25+
# These example options assume a GCC-style toolchain is used for cross compilation,
26+
# and uses the same warning options that are applied at the mission level.
27+
#
28+
add_compile_options(
29+
-std=c99 # Target the C99 standard (without gcc extensions)
30+
-pedantic # Issue all the warnings demanded by strict ISO C
31+
-Wall # Warn about most questionable operations
32+
-Wstrict-prototypes # Warn about missing prototypes
33+
-Wwrite-strings # Warn if not treating string literals as "const"
34+
-Wpointer-arith # Warn about suspicious pointer operations
35+
-Werror # Treat warnings as errors (code should be clean)
36+
-Wno-format-truncation # Inhibit printf-style format truncation warnings
37+
-Wno-stringop-truncation # Inhibit string operation truncation warnings
38+
)
39+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Example arch_build_custom.cmake
3+
# -------------------------------
4+
#
5+
# On native builds only, add strict cast alignment warnings
6+
# This requires a newer version of gcc
7+
#
8+
add_compile_options(
9+
-Wcast-align=strict # Warn about casts that increase alignment requirements
10+
-fno-common # Do not use a common section for globals
11+
)
12+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
CFE_LIB, cfe_assert, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0;
2+
CFE_LIB, sample_lib, SAMPLE_LIB_Init, SAMPLE_LIB, 0, 0, 0x0, 0;
3+
CFE_APP, sample_app, SAMPLE_APP_Main, SAMPLE_APP, 50, 16384, 0x0, 0;
4+
CFE_APP, my_app, my_app_Main, my_app, 50, 16384, 0x0, 0;
5+
CFE_APP, ci_lab, CI_LAB_AppMain, CI_LAB_APP, 60, 16384, 0x0, 0;
6+
CFE_APP, to_lab, TO_LAB_AppMain, TO_LAB_APP, 70, 16384, 0x0, 0;
7+
CFE_APP, sch_lab, SCH_LAB_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0;
8+
9+
!
10+
! Startup script fields:
11+
! 1. Object Type -- CFE_APP for an Application, or CFE_LIB for a library.
12+
! 2. Path/Filename -- This is a cFE Virtual filename, not a vxWorks device/pathname
13+
! 3. Entry Point -- This is the "main" function for Apps.
14+
! 4. CFE Name -- The cFE name for the APP or Library
15+
! 5. Priority -- This is the Priority of the App, not used for Library
16+
! 6. Stack Size -- This is the Stack size for the App, not used for the Library
17+
! 7. Load Address -- This is the Optional Load Address for the App or Library. Currently not implemented
18+
! so keep it at 0x0.
19+
! 8. Exception Action -- This is the Action the cFE should take if the App has an exception.
20+
! 0 = Just restart the Application
21+
! Non-Zero = Do a cFE Processor Reset
22+
!
23+
! Other Notes:
24+
! 1. The software will not try to parse anything after the first '!' character it sees. That
25+
! is the End of File marker.
26+
! 2. Common Application file extensions:
27+
! Linux = .so ( ci.so )
28+
! OS X = .bundle ( ci.bundle )
29+
! Cygwin = .dll ( ci.dll )
30+
! vxWorks = .o ( ci.o )
31+
! RTEMS with S-record Loader = .s3r ( ci.s3r )
32+
! RTEMS with CEXP Loader = .o ( ci.o )
33+
! 3. The filename field (2) no longer requires a fully-qualified filename; the path and extension
34+
! may be omitted. If omitted, the standard virtual path (/cf) and a platform-specific default
35+
! extension will be used, which is derived from the build system.

sample_defs/default_osconfig.cmake

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##########################################################################
2+
#
3+
# CFE-specific configuration options for OSAL
4+
#
5+
# This file specifies the CFE-specific values for various compile options
6+
# supported by OSAL.
7+
#
8+
# OSAL has many configuration options, which may vary depending on the
9+
# specific version of OSAL in use. The complete list of OSAL options,
10+
# along with a description of each, can be found OSAL source in the file:
11+
#
12+
# osal/default_config.cmake
13+
#
14+
# A CFE framework build utilizes mostly the OSAL default configuration.
15+
# This file only contains a few specific overrides that tune for a debug
16+
# environment, rather than a deployment environment.
17+
#
18+
# ALSO NOTE: There is also an arch-specific addendum to this file
19+
# to allow further tuning on a per-arch basis, in the form of:
20+
#
21+
# ${TOOLCHAIN_NAME}_osconfig.cmake
22+
#
23+
# See "native_osconfig.cmake" for options which apply only to "native" builds.
24+
#
25+
##########################################################################
26+
27+
#
28+
# OSAL_CONFIG_DEBUG_PRINTF
29+
# ------------------------
30+
#
31+
# For CFE builds this can be helpful during debugging as it will display more
32+
# specific error messages for various OSAL error/warning events, such as if a
33+
# module cannot be loaded or a file cannot be opened for some reason.
34+
#
35+
set(OSAL_CONFIG_DEBUG_PRINTF TRUE)

0 commit comments

Comments
 (0)