forked from ARM-software/CSAL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
csal: Initial transfer from subversion.
Signed-off-by: Mike Leach <[email protected]>
- Loading branch information
0 parents
commit 721eb0d
Showing
121 changed files
with
24,274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (C) ARM Ltd. 2016. All rights reserved. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
# CoreSight Access Library | ||
# | ||
# This makefile builds the CS-Access library for both static and dynamic linked versions. | ||
# | ||
# Default builds the standard release versions, linux application space | ||
# | ||
# to build debug add DEBUG=1 to the make command line | ||
# to build in the v7 debug halt extensions add DBG_HALT=1 to the make command line | ||
# to build for baremetal add BAREMETAL=1 to the make command line | ||
# | ||
# e.g. to build the standard debug versions: | ||
# make DEBUG=1 | ||
# | ||
|
||
# default settings | ||
CC=gcc | ||
CFLAGS=-Wall -Wno-switch | ||
|
||
LIB_DIR = ../lib/rel | ||
LIB_DIR_BM=../lib/rel_bm | ||
LIB_NAME=csaccess | ||
LIB_NAME_UTIL=csacc_util | ||
BUILD_DIR=./rel | ||
BUILD_DIR_BM=./rel_bm | ||
|
||
# build options | ||
ifeq ($(DEBUG),1) | ||
CFLAGS+= -O0 -DDEBUG -g | ||
LIB_DIR = ../lib/dbg | ||
LIB_DIR_BM = ../lib/dbg_bm | ||
BUILD_DIR=./dbg | ||
BUILD_DIR_BM=./dbg_bm | ||
else | ||
CFLAGS+= -O2 -DNDEBUG | ||
endif | ||
|
||
# platform options | ||
ifeq ($(BAREMETAL),1) | ||
CFLAGS+= -DBAREMETAL | ||
LIB_DIR=$(LIB_DIR_BM) | ||
BUILD_DIR=$(BUILD_DIR_BM) | ||
endif | ||
|
||
ifeq ($(DBG_HALT),1) | ||
LIB_NAME=csaccess_dbghlt | ||
CFLAGS+= -DUSING_V7_DBG_HALT | ||
CSSRC_HALT=cs_debug_halt.c | ||
endif | ||
|
||
# LPAE options | ||
ifeq ($(LPAE),1) | ||
CFLAGS+= -DLPAE | ||
endif | ||
|
||
# 64 bit VAs | ||
ifeq ($(VA64),1) | ||
CFLAGS+= -DCS_VA64BIT | ||
endif | ||
|
||
#disable diagnostic printing | ||
ifeq ($(NO_DIAG),1) | ||
CFLAGS+= -DDIAG=0 | ||
endif | ||
|
||
#disable checks | ||
ifeq ($(NO_CHECK),1) | ||
CFLAGS+= -DCHECK=0 | ||
endif | ||
|
||
# ensure that the compiler can find the library source | ||
vpath %.c ../source | ||
|
||
# the source files | ||
CSSRC= cs_init_manage.c \ | ||
cs_debug_sample.c \ | ||
cs_pmu.c \ | ||
cs_access_cmnfns.c \ | ||
cs_cti_ect.c \ | ||
cs_etm.c \ | ||
cs_etm_v4.c \ | ||
cs_reg_access.c \ | ||
cs_sw_stim.c \ | ||
cs_topology.c \ | ||
cs_trace_sink.c \ | ||
cs_trace_source.c \ | ||
cs_ts_gen.c | ||
|
||
# add in the extra for halting debug - blank if not in use | ||
CSSRC+=$(CSSRC_HALT) | ||
|
||
|
||
CSUTILSRC= cs_trace_metadata.c \ | ||
cs_util_create_snapshot.c \ | ||
csregistration.c | ||
|
||
|
||
# set the include paths | ||
INCS= -I. \ | ||
-I../include | ||
|
||
|
||
# build rules for the .a lib | ||
$(BUILD_DIR)/a/%.o: %.c | ||
$(CC) $(CFLAGS) $(INCS) -c $< -o $@ | ||
A_OBJS=$(addprefix $(BUILD_DIR)/a/,$(CSSRC:%.c=%.o)) | ||
A_OBJS_UTIL=$(addprefix $(BUILD_DIR)/a/,$(CSUTILSRC:%.c=%.o)) | ||
|
||
# build rules for the .so lib | ||
$(BUILD_DIR)/so/%.o: %.c | ||
$(CC) $(CFLAGS) -fPIC $(INCS) -c $< -o $@ | ||
SO_OBJS=$(addprefix $(BUILD_DIR)/so/,$(CSSRC:%.c=%.o)) | ||
SO_OBJS_UTIL=$(addprefix $(BUILD_DIR)/so/,$(CSUTILSRC:%.c=%.o)) | ||
|
||
# build both lib types | ||
.PHONY: all | ||
all: lib_a lib_so | ||
|
||
# create the lib output and build dirs | ||
.PHONY: lib_dir | ||
lib_dir: | ||
@mkdir -p $(LIB_DIR) | ||
@mkdir -p $(BUILD_DIR)/a | ||
@mkdir -p $(BUILD_DIR)/so | ||
@echo "building to $(LIB_DIR)" | ||
|
||
# create the static link libraries | ||
.PHONY: lib_a | ||
lib_a: lib_dir lib$(LIB_NAME).a lib$(LIB_NAME_UTIL).a | ||
|
||
lib$(LIB_NAME).a: $(A_OBJS) | ||
ar cr $(LIB_DIR)/lib$(LIB_NAME).a $(A_OBJS) | ||
|
||
lib$(LIB_NAME_UTIL).a: $(A_OBJS_UTIL) | ||
ar cr $(LIB_DIR)/lib$(LIB_NAME_UTIL).a $(A_OBJS_UTIL) | ||
|
||
# create the dynamic link libraries | ||
.PHONY: lib_so | ||
lib_so: lib_dir lib$(LIB_NAME).so lib$(LIB_NAME_UTIL).so | ||
|
||
lib$(LIB_NAME).so: $(SO_OBJS) | ||
$(CC) -shared -o $(LIB_DIR)/lib$(LIB_NAME).so $(SO_OBJS) | ||
|
||
lib$(LIB_NAME_UTIL).so: $(SO_OBJS_UTIL) | ||
$(CC) -shared -o $(LIB_DIR)/lib$(LIB_NAME_UTIL).so $(SO_OBJS_UTIL) | ||
|
||
|
||
# clean all object files and libraries | ||
.PHONY: clean | ||
clean: clean_objs | ||
rm -fr $(LIB_DIR)/*.so | ||
rm -fr $(LIB_DIR)/*.a | ||
|
||
.PHONY: clean_objs | ||
clean_objs: | ||
rm -fr $(A_OBJS) | ||
rm -fr $(A_OBJS_UTIL) | ||
rm -fr $(SO_OBJS) | ||
rm -fr $(SO_OBJS_UTIL) | ||
|
||
###### library maintenance operaions ################################## | ||
|
||
# CS Lib API Documentation | ||
docs: ../doxygen-cfg.txt | ||
cd ../. && doxygen doxygen-cfg.txt | ||
|
||
|
||
# create a distribution file. | ||
libsources = ../source ../include ../build/Makefile ../build/readme_build.md | ||
demosources = ../demos/*.c ../demos/*.h ../demos/Makefile ../demos/readme_demos.md | ||
pythonsources = ../python/*.py ../python/Makefile ../python/csaccess_py.c ../python/csaccess.i | ||
sources = $(libsources) $(demosources) $(pythonsources) | ||
distfile = csaccess.tar.gz | ||
|
||
.PHONY: dist | ||
dist: $(distfile) | ||
|
||
# readme.html | ||
|
||
$(distfile): $(sources) ../doxygen-cfg.txt ../readme.md ../readme.xml | ||
tar -czf $@ $^ | ||
tar -tzf $@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Building the Library {#buildlib} | ||
==================== | ||
|
||
Default Build | ||
------------- | ||
|
||
The library is build from within the `./build` directory using the supplied `Makefile`. | ||
Simply change to the directory and run `make` to build the default version of the library. | ||
|
||
The default version will be a linux user application release build, built into the `./lib/rel` | ||
sub-directory off the main CoreSight Access Library directory. This version will not have any | ||
of the optional components in the library. | ||
|
||
The library will be built as both a static link library `libcsaccess.a` and a | ||
dynamic link library `libcsaccess.so`. | ||
|
||
The utility library will be built at the same time using the same parameters. This will | ||
appear as `libcsacc_util.a` and `libcsacc_util.so`. | ||
|
||
Additional Build Options | ||
------------------------ | ||
The following options can be added the make command line:- | ||
- `DEBUG=1` : This will create the debug versions of the library in the `./lib/dbg` subdirectory. | ||
- `BAREMETAL=1` : This will create a BareMetal version of the library. Linux headers will not be used. | ||
|
||
The library will be delivered into the `./lib/rel_bm` directory. This library is suitable for use | ||
in embedded applications not running under Linux. | ||
|
||
- `LPAE=1` : This will create a version of the library with long physical address types - suitable for | ||
use on cores using the LPAE extensions. This defines the `LPAE` macro at compile time to | ||
enable large physical addresses. | ||
|
||
- `VA64=1` : This will create a version of the library using 64 bit virtual address types. Suitable for | ||
V8 architecture cores. This defines the `CS_VA64BIT` macro at compile time to enable 64 bit | ||
virtual addresses. | ||
|
||
- `NO_DIAG=1` : This will disable the diagnostic `printf()` messages. May be required for Baremetal version if | ||
external printing unsupported. | ||
|
||
- `NO_CHECK=1` : This will disable additional diagnostic self checks - writes to CS registers are logged and read back. | ||
|
||
- `DBG_HALT=1` : This will build a version of the library with the optional v7 Architecture intrusive | ||
halt mode debug functions built into the library. | ||
|
||
The library names will be altered to `libcsaccess_dbghlt.a` and `libcsaccess_dbghlt.so` | ||
|
||
Options can be combined on the command line to create specific versions of the library. | ||
|
||
e.g. | ||
|
||
make DEBUG=1 BAREMETAL=1 | ||
|
||
will create a debug version of the Baremetal library, delivered into the `./lib/dbg_bm` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/python | ||
|
||
""" | ||
Check all source files (including this one) for the correct software license. | ||
Copyright (C) ARM Ltd. 2016. All rights reserved. | ||
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. | ||
""" | ||
|
||
import os | ||
|
||
|
||
def fn_is_source(fn): | ||
base, ext = os.path.splitext(fn) | ||
return ext in [".c", ".cpp", ".h", ".py"] | ||
|
||
|
||
def fn_is_licensed(fn): | ||
found = None | ||
f = open(fn) | ||
lno = 0 | ||
for ln in f: | ||
lno += 1 | ||
ix = ln.find("apache.org/licenses/LICENSE-2.0") | ||
if ix >= 0: | ||
found = lno | ||
break | ||
if lno > 20: | ||
break | ||
if False: | ||
if found is not None: | ||
print "%s: found at line %u" % (fn, found) | ||
return found is not None | ||
|
||
|
||
def check_all_sources_licensed(dir): | ||
n_files = 0 | ||
for root, dirs, files in os.walk(dir): | ||
for f in files: | ||
fn = os.path.join(root, f) | ||
if fn_is_source(fn): | ||
n_files += 1 | ||
if not fn_is_licensed(fn): | ||
print "%s: not licensed" % fn | ||
|
||
|
||
check_all_sources_licensed(os.path.dirname(os.path.realpath(__file__))) | ||
|
Oops, something went wrong.