mirror of
https://github.com/drasko/codezero.git
synced 2026-04-17 17:29:04 +02:00
Make the address conversion for start.axf.S creation more sophisticated to deal with Python writing a Python literal.
This commit is contained in:
@@ -22,6 +22,15 @@ import subprocess
|
|||||||
|
|
||||||
Import('environment', 'images')
|
Import('environment', 'images')
|
||||||
|
|
||||||
|
def convertAddress(address):
|
||||||
|
'''Convert the string representation of the address given as parameter to a string representation of the
|
||||||
|
address without the top four bits set. The issue here is that Python has a penchant for adding L to the
|
||||||
|
end to create a Python literal. This is not wanted here.'''
|
||||||
|
value = hex(int(address, 16) - 0xf0000000)
|
||||||
|
if value[-1] in ['l', 'L']:
|
||||||
|
value = value[:-1]
|
||||||
|
return value
|
||||||
|
|
||||||
def ksymToLds(target, source, env):
|
def ksymToLds(target, source, env):
|
||||||
symbols = ['break_virtual']
|
symbols = ['break_virtual']
|
||||||
with open(target[0].path, 'w') as asmFile:
|
with open(target[0].path, 'w') as asmFile:
|
||||||
@@ -45,7 +54,7 @@ def ksymToLds(target, source, env):
|
|||||||
.global %s
|
.global %s
|
||||||
.type %s, function
|
.type %s, function
|
||||||
.equ %s, %s
|
.equ %s, %s
|
||||||
''' % (symbol, symbol, symbol, (hex(int(address, 16) - 0xf0000000))))
|
''' % (symbol, symbol, symbol, convertAddress(address)))
|
||||||
|
|
||||||
def createKernelSFile(target, source, env):
|
def createKernelSFile(target, source, env):
|
||||||
with open(target[0].path, 'w') as asmFile:
|
with open(target[0].path, 'w') as asmFile:
|
||||||
|
|||||||
Reference in New Issue
Block a user