Skip to content

GCC_ARM changes to support uVisor #1917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tools/export/gcc_arm_common.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ CPU = {% block cpu %}{% for cf in cpu_flags %}{{cf|replace("-mfloat-abi=softfp",
CC_FLAGS = {% block cc_flags %}$(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP{% endblock %}
CC_SYMBOLS = {% block cc_symbols %}{% for s in symbols %}-D{{s}} {% endfor %}{% endblock %}

LD_FLAGS = {%- block ld_flags -%}
LD_FLAGS = {%- block ld_flags -%} $(CPU) -Wl,--gc-sections --specs=nano.specs -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r
{%- if "-mcpu=cortex-m0" in cpu_flags or "-mcpu=cortex-m0plus" in cpu_flags -%}
{{ ' ' }}$(CPU) -Wl,--gc-sections --specs=nano.specs -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
#LD_FLAGS += -u _printf_float -u _scanf_float
{%- else -%}
{{ ' ' }}$(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
{{ ' ' }}-u _printf_float -u _scanf_float
{%- endif -%}
{% endblock %}
LD_SYS_LIBS = {% block ld_sys_libs %}-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys{% endblock %}
Expand Down
7 changes: 5 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import sys
import os
import json
import fnmatch

ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, ROOT)
Expand Down Expand Up @@ -105,8 +106,10 @@

all_tests_keys = all_tests.keys()
for name in all_names:
if name in all_tests_keys:
tests[name] = all_tests[name]
if any(fnmatch.fnmatch(testname, name) for testname in all_tests):
for testname, test in all_tests.items():
if fnmatch.fnmatch(testname, name):
tests[testname] = test
else:
print "[Warning] Test with name '%s' was not found in the available tests" % (name)
else:
Expand Down
10 changes: 5 additions & 5 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,12 @@ def print_notify(self, event, silent=False):
"""
msg = None

if event['type'] in ['info', 'debug']:
if not self.VERBOSE and event['type'] == 'tool_error':
msg = event['message']


elif event['type'] in ['info', 'debug']:
msg = event['message']

elif event['type'] == 'cc':
event['severity'] = event['severity'].title()
event['file'] = basename(event['file'])
Expand Down Expand Up @@ -773,9 +776,6 @@ def link_program(self, r, tmp_path, name):
def default_cmd(self, command):
self.debug("Command: %s"% ' '.join(command))
_stdout, _stderr, _rc = run_cmd(command)
# Print all warning / erros from stderr to console output
for error_line in _stderr.splitlines():
print error_line

self.debug("Return: %s"% _rc)

Expand Down
12 changes: 6 additions & 6 deletions tools/toolchains/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self, target, options=None, notify=None, macros=None, silent=False,
self.cc = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "-std=gnu99", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags
self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cppc.replace('\\', '/'), "-std=gnu++98", "-fno-rtti", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags

self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu
self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r", "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r"] + self.cpu
self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]

self.ar = join(tool_path, "arm-none-eabi-ar")
Expand Down Expand Up @@ -175,7 +175,7 @@ def compile(self, cc, source, object, includes):
cmd.extend(self.get_dep_option(object))

cmd.extend(["-o", object, source])

# Call cmdline hook
cmd = self.hook.get_cmdline_compiler(cmd)

Expand All @@ -194,13 +194,13 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
name, _ = splitext(basename(l))
libs.append("-l%s" % name[3:])
libs.extend(["-l%s" % l for l in self.sys_libs])

# Build linker command
map_file = splitext(output)[0] + ".map"
cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"]
if mem_map:
cmd.extend(['-T', mem_map])

for L in lib_dirs:
cmd.extend(['-L', L])
cmd.extend(libs)
Expand All @@ -215,7 +215,7 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
cmd_list = []
for c in cmd[1:]:
if c:
cmd_list.append(('"%s"' % c) if not c.startswith('-') else c)
cmd_list.append(('"%s"' % c) if not c.startswith('-') else c)
string = " ".join(cmd_list).replace("\\", "/")
f.write(string)

Expand All @@ -228,7 +228,7 @@ def archive(self, objects, lib_path):
with open(archive_files, "wb") as f:
o_list = []
for o in objects:
o_list.append('"%s"' % o)
o_list.append('"%s"' % o)
string = " ".join(o_list).replace("\\", "/")
f.write(string)

Expand Down