2020-11-28 12:22:29 +04:00
|
|
|
import os
|
|
|
|
|
2021-02-07 14:11:39 +04:00
|
|
|
base_address = 0x80400000
|
2020-11-28 12:22:29 +04:00
|
|
|
step = 0x20000
|
|
|
|
linker = 'src/linker.ld'
|
|
|
|
|
|
|
|
app_id = 0
|
|
|
|
apps = os.listdir('src/bin')
|
|
|
|
apps.sort()
|
|
|
|
for app in apps:
|
|
|
|
app = app[:app.find('.')]
|
|
|
|
lines = []
|
|
|
|
lines_before = []
|
|
|
|
with open(linker, 'r') as f:
|
|
|
|
for line in f.readlines():
|
|
|
|
lines_before.append(line)
|
|
|
|
line = line.replace(hex(base_address), hex(base_address+step*app_id))
|
|
|
|
lines.append(line)
|
|
|
|
with open(linker, 'w+') as f:
|
|
|
|
f.writelines(lines)
|
2020-11-30 06:33:01 +04:00
|
|
|
os.system('cargo build --bin %s --release' % app)
|
2020-11-28 12:22:29 +04:00
|
|
|
print('[build.py] application %s start with address %s' %(app, hex(base_address+step*app_id)))
|
|
|
|
with open(linker, 'w+') as f:
|
|
|
|
f.writelines(lines_before)
|
|
|
|
app_id = app_id + 1
|