mirror of
https://github.com/google/pebble.git
synced 2025-05-19 01:44:53 +00:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
41
waftools/objcopy.py
Normal file
41
waftools/objcopy.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Copyright 2024 Google LLC
|
||||
#
|
||||
# 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.
|
||||
|
||||
# FIXME: For some reason this doesn't work with multiple rules with the same input extension.
|
||||
#from waflib import TaskGen
|
||||
#TaskGen.declare_chain(name='hex', rule='${OBJCOPY} -O ihex ${SRC} ${TGT}', ext_in='.elf', ext_out='.hex')
|
||||
#TaskGen.declare_chain(name='bin', rule='${OBJCOPY} -O binary ${SRC} ${TGT}', ext_in='.elf', ext_out='.bin')
|
||||
|
||||
def objcopy(task, mode, extra_args=None):
|
||||
cmd = 'arm-none-eabi-objcopy -S -R .stack -R .priv_bss -R .bss '
|
||||
|
||||
if hasattr(task.generator, 'extra_args'):
|
||||
cmd += '%s ' % (task.generator.extra_args)
|
||||
|
||||
if extra_args is not None:
|
||||
cmd += '%s ' % (extra_args)
|
||||
|
||||
cmd += '-O %s "%s" "%s"' % (mode, task.inputs[0].abspath(), task.outputs[0].abspath())
|
||||
return task.exec_command(cmd)
|
||||
|
||||
def objcopy_fill_bss(task, mode):
|
||||
return task.exec_command('arm-none-eabi-objcopy -O %s -j .text -j .data '
|
||||
'-j .bss --set-section-flags .bss=alloc,load,contents "%s" "%s"' %
|
||||
(mode, task.inputs[0].abspath(), task.outputs[0].abspath()))
|
||||
|
||||
def objcopy_hex(task):
|
||||
return objcopy(task, 'ihex')
|
||||
|
||||
def objcopy_bin(task):
|
||||
return objcopy(task, 'binary')
|
Loading…
Add table
Add a link
Reference in a new issue