Skip to content

armcc - remove fromelf output before regenerating one #6344

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

Merged
merged 1 commit into from
Mar 21, 2018
Merged
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
13 changes: 11 additions & 2 deletions tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"""
import re
from copy import copy
from os.path import join, dirname, splitext, basename, exists, relpath
from os import makedirs, write, curdir
from os.path import join, dirname, splitext, basename, exists, relpath, isfile
from os import makedirs, write, curdir, remove
from tempfile import mkstemp
from shutil import rmtree

from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
from tools.hooks import hook_tool
Expand Down Expand Up @@ -251,6 +252,14 @@ def binary(self, resources, elf, bin):
bin_arg = {".bin": "--bin", ".hex": "--i32"}[fmt]
cmd = [self.elf2bin, bin_arg, '-o', bin, elf]
cmd = self.hook.get_cmdline_binary(cmd)

# remove target binary file/path
if exists(bin):
if isfile(bin):
remove(bin)
else:
rmtree(bin)

self.cc_verbose("FromELF: %s" % ' '.join(cmd))
self.default_cmd(cmd)

Expand Down