Fixed hexadecimal conversions where output has the most significant bit as 1

If hex converted had a 1 in the MSB, an L was appended to the number.
The conversion routine removes this.
This commit is contained in:
Bahadir Balban
2009-09-28 14:04:19 +03:00
parent 1c2eaae8b3
commit fb1de576cb
3 changed files with 16 additions and 5 deletions

9
config/lib.py Normal file
View File

@@ -0,0 +1,9 @@
#! /usr/bin/env python2.6
# -*- mode: python; coding: utf-8; -*-
#
def conv_hex(val):
hexval = hex(val)
if hexval[-1:] == 'L':
hexval = hexval[:-1]
return hexval

View File

@@ -17,6 +17,7 @@ SCRIPTROOT = os.path.abspath(os.path.dirname(__file__))
from config.projpaths import *
from config.configuration import *
from config.lib import *
class BareContGenerator:
def __init__(self):
@@ -68,11 +69,11 @@ class BareContGenerator:
fout.write(name_header)
fout.write('\t' + cont.name + '\n')
fout.write(pager_lma_header)
fout.write('\t' + hex(cont.pager_lma) + '\n')
fout.write('\t' + conv_hex(cont.pager_lma) + '\n')
fout.write(pager_size_header)
fout.write('\t' + hex(cont.pager_size) + '\n')
fout.write('\t' + conv_hex(cont.pager_size) + '\n')
fout.write(pager_vma_header)
fout.write('\t' + hex(cont.pager_vma) + '\n')
fout.write('\t' + conv_hex(cont.pager_vma) + '\n')
for ireg in range(cont.virt_regions):
fout.write(pager_virtmem_header % ireg)
fout.write('\t' + cont.virtmem["START"][ireg] + ' - ' + cont.virtmem["END"][ireg] + '\n')
@@ -133,8 +134,8 @@ class BareContGenerator:
with open(self.linker_lds_in) as fin:
str = fin.read()
with open(self.linker_lds_out, 'w+') as fout:
fout.write(str % (hex(cont.pager_vma), \
hex(cont.pager_lma)))
fout.write(str % (conv_hex(cont.pager_vma), \
conv_hex(cont.pager_lma)))
def bare_container_generate(self, config):
self.check_create_bare_sources(config)

View File

@@ -14,6 +14,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), PROJRELR
from config.projpaths import *
from config.configuration import *
from config.lib import *
# Convert address from python literal to numeric value
def address_remove_literal(address):