|
@ -1,7 +1,7 @@ |
|
|
Import("env") |
|
|
Import("env") |
|
|
|
|
|
|
|
|
# Relocate firmware from 0x08000000 to 0x0800A000 |
|
|
# Relocate firmware from 0x08000000 to 0x0800A000 |
|
|
env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000")) |
|
|
env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000")) |
|
|
#alternatively, for STSTM <=5.1.0 use line below |
|
|
#alternatively, for STSTM <=5.1.0 use line below |
|
|
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728)) |
|
|
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728)) |
|
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x0800A000")) |
|
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x0800A000")) |
|
@ -9,7 +9,7 @@ env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/jgaurora_a5s_a1. |
|
|
|
|
|
|
|
|
#append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin' |
|
|
#append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin' |
|
|
def addboot(source,target,env): |
|
|
def addboot(source,target,env): |
|
|
import os |
|
|
import os |
|
|
|
|
|
|
|
|
firmware = open(target[0].path, "rb") |
|
|
firmware = open(target[0].path, "rb") |
|
|
lengthfirmware = os.path.getsize(target[0].path) |
|
|
lengthfirmware = os.path.getsize(target[0].path) |
|
@ -29,7 +29,7 @@ def addboot(source,target,env): |
|
|
while position < lengthfirmware: |
|
|
while position < lengthfirmware: |
|
|
byte = firmware.read(1) |
|
|
byte = firmware.read(1) |
|
|
firmwareimage.write(byte) |
|
|
firmwareimage.write(byte) |
|
|
position += 1 |
|
|
position += 1 |
|
|
bootloader.close() |
|
|
bootloader.close() |
|
|
firmware.close() |
|
|
firmware.close() |
|
|
firmwareimage.close() |
|
|
firmwareimage.close() |
|
@ -37,7 +37,7 @@ def addboot(source,target,env): |
|
|
if os.path.exists(firmware_without_bootloader_dir): |
|
|
if os.path.exists(firmware_without_bootloader_dir): |
|
|
os.remove(firmware_without_bootloader_dir) |
|
|
os.remove(firmware_without_bootloader_dir) |
|
|
os.rename(target[0].path, firmware_without_bootloader_dir) |
|
|
os.rename(target[0].path, firmware_without_bootloader_dir) |
|
|
#os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin') |
|
|
#os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin') |
|
|
|
|
|
|
|
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", addboot); |
|
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", addboot); |
|
|
|
|
|
|
|
|