Skip to content

Commit 5570205

Browse files
committed
scons添加编译签名支持,为m33工程添加签名固件
1 parent dab991d commit 5570205

File tree

45 files changed

+7798
-6640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7798
-6640
lines changed

projects/Edgi-Talk_ADC/Edgi_Talk_M33_ADC/SConstruct

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ except Exception as e:
2222
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
2323

2424
DefaultEnvironment(tools=[])
25-
env = Environment(tools = ['mingw'],
25+
env = Environment(tools = ['mingw'], ENV=os.environ,
2626
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
2727
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
2828
AR = rtconfig.AR, ARFLAGS = '-rc',
2929
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
3030
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
3131
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
3232

33+
OBJCOPY = os.path.join(rtconfig.EXEC_PATH, 'arm-none-eabi-objcopy')
34+
3335
if rtconfig.PLATFORM in ['iccarm']:
3436
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
3537
env.Replace(ARFLAGS = [''])
@@ -131,3 +133,25 @@ else:
131133

132134
# make a building
133135
DoBuilding(TARGET, objs)
136+
137+
# Generate HEX file
138+
DEBUG_DIR = '../Debug'
139+
if not os.path.exists(DEBUG_DIR):
140+
os.makedirs(DEBUG_DIR)
141+
hex_file = env.Command(DEBUG_DIR + '/rtthread.hex', TARGET, OBJCOPY + ' -O ihex $SOURCE $TARGET')
142+
143+
# Secure image packaging using edgeprotecttools (Windows only)
144+
if platform.system() == 'Windows':
145+
EDGEPROTECTTOOLS = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(SDK_ROOT))), 'tools', 'edgeprotecttools', 'bin', 'edgeprotecttools.exe')
146+
BOOT_CONFIG = os.path.join(SDK_ROOT, 'config', 'boot_with_extended_boot_scons.json')
147+
148+
if os.path.exists(EDGEPROTECTTOOLS) and os.path.exists(BOOT_CONFIG):
149+
secure_image = env.Command(
150+
'secure_image', # Pseudo target
151+
hex_file,
152+
'"' + EDGEPROTECTTOOLS + '" run-config -i "' + BOOT_CONFIG + '"'
153+
)
154+
else:
155+
print("edgeprotecttools or boot config not found, skipping secure image packaging")
156+
print("EDGEPROTECTTOOLS:", EDGEPROTECTTOOLS)
157+
print("BOOT_CONFIG:", BOOT_CONFIG)

projects/Edgi-Talk_ADC/Edgi_Talk_M33_ADC/config/boot_with_extended_boot.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,34 @@
3232
]
3333
}
3434
]
35+
},
36+
{
37+
"name": "merge",
38+
"description": "combine individual project hex files into a single hex",
39+
"enabled": true,
40+
"commands" :
41+
[
42+
{
43+
"command" : "merge",
44+
"inputs" :
45+
[
46+
{
47+
"file" : "../Debug/rtthread.hex"
48+
},
49+
{
50+
"file" : "../tools/edgeprotecttools/cm33_s_signed_fw/proj_cm33_s_signed.hex"
51+
}
52+
],
53+
"outputs" :
54+
[
55+
{
56+
"file" : "../Debug/rtthread.hex",
57+
"format" : "ihex",
58+
"overlap" : "ignore"
59+
}
60+
]
61+
}
62+
]
3563
}
3664
]
3765
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"schema-version": 1.0,
3+
"content": [
4+
{
5+
"name": "relocate_proj_cm33_ns",
6+
"description": "relocate the hex to a programmable (S-BUS) address",
7+
"enabled": true,
8+
"commands": [
9+
{
10+
"command": "hex-relocate",
11+
"inputs": [
12+
{
13+
"file": "../Debug/rtthread.hex",
14+
"regions": [
15+
{ "start": "0x02000000", "size": "0x00080000", "dest": "0x22000000" },
16+
{ "start": "0x04000000", "size": "0x00100000", "dest": "0x24000000" },
17+
{ "start": "0x06000000", "size": "0x00500000", "dest": "0x26000000" },
18+
{ "start": "0x08000000", "size": "0x01000000", "dest": "0x60000000" },
19+
{ "start": "0x0C000000", "size": "0x01000000", "dest": "0x64000000" },
20+
{ "start": "0x12000000", "size": "0x00080000", "dest": "0x32000000" },
21+
{ "start": "0x14000000", "size": "0x00100000", "dest": "0x34000000" },
22+
{ "start": "0x16000000", "size": "0x00500000", "dest": "0x36000000" },
23+
{ "start": "0x18000000", "size": "0x01000000", "dest": "0x70000000" },
24+
{ "start": "0x1C000000", "size": "0x01000000", "dest": "0x74000000" }
25+
]
26+
}
27+
],
28+
"outputs": [
29+
{
30+
"file": "../Debug/rtthread.hex"
31+
}
32+
]
33+
}
34+
]
35+
},
36+
{
37+
"name": "merge",
38+
"description": "combine individual project hex files into a single hex",
39+
"enabled": true,
40+
"commands" :
41+
[
42+
{
43+
"command" : "merge",
44+
"inputs" :
45+
[
46+
{
47+
"file" : "../Debug/rtthread.hex"
48+
},
49+
{
50+
"file" : "../../../tools/edgeprotecttools/cm33_s_signed_fw/proj_cm33_s_signed.hex"
51+
}
52+
],
53+
"outputs" :
54+
[
55+
{
56+
"file" : "../Debug/rtthread.hex",
57+
"format" : "ihex",
58+
"overlap" : "ignore"
59+
}
60+
]
61+
}
62+
]
63+
}
64+
]
65+
}

projects/Edgi-Talk_AHT20/Edgi_Talk_M33_AHT20/.cproject

Lines changed: 5 additions & 19 deletions
Large diffs are not rendered by default.

projects/Edgi-Talk_AHT20/Edgi_Talk_M33_AHT20/SConstruct

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ except Exception as e:
2222
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
2323

2424
DefaultEnvironment(tools=[])
25-
env = Environment(tools = ['mingw'],
25+
env = Environment(tools = ['mingw'], ENV=os.environ,
2626
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
2727
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
2828
AR = rtconfig.AR, ARFLAGS = '-rc',
2929
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
3030
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
3131
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
3232

33+
OBJCOPY = os.path.join(rtconfig.EXEC_PATH, 'arm-none-eabi-objcopy')
34+
3335
if rtconfig.PLATFORM in ['iccarm']:
3436
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
3537
env.Replace(ARFLAGS = [''])
@@ -131,3 +133,25 @@ else:
131133

132134
# make a building
133135
DoBuilding(TARGET, objs)
136+
137+
# Generate HEX file
138+
DEBUG_DIR = '../Debug'
139+
if not os.path.exists(DEBUG_DIR):
140+
os.makedirs(DEBUG_DIR)
141+
hex_file = env.Command(DEBUG_DIR + '/rtthread.hex', TARGET, OBJCOPY + ' -O ihex $SOURCE $TARGET')
142+
143+
# Secure image packaging using edgeprotecttools (Windows only)
144+
if platform.system() == 'Windows':
145+
EDGEPROTECTTOOLS = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(SDK_ROOT))), 'tools', 'edgeprotecttools', 'bin', 'edgeprotecttools.exe')
146+
BOOT_CONFIG = os.path.join(SDK_ROOT, 'config', 'boot_with_extended_boot_scons.json')
147+
148+
if os.path.exists(EDGEPROTECTTOOLS) and os.path.exists(BOOT_CONFIG):
149+
secure_image = env.Command(
150+
'secure_image', # Pseudo target
151+
hex_file,
152+
'"' + EDGEPROTECTTOOLS + '" run-config -i "' + BOOT_CONFIG + '"'
153+
)
154+
else:
155+
print("edgeprotecttools or boot config not found, skipping secure image packaging")
156+
print("EDGEPROTECTTOOLS:", EDGEPROTECTTOOLS)
157+
print("BOOT_CONFIG:", BOOT_CONFIG)

projects/Edgi-Talk_AHT20/Edgi_Talk_M33_AHT20/config/boot_with_extended_boot.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,34 @@
3232
]
3333
}
3434
]
35+
},
36+
{
37+
"name": "merge",
38+
"description": "combine individual project hex files into a single hex",
39+
"enabled": true,
40+
"commands" :
41+
[
42+
{
43+
"command" : "merge",
44+
"inputs" :
45+
[
46+
{
47+
"file" : "../Debug/rtthread.hex"
48+
},
49+
{
50+
"file" : "../tools/edgeprotecttools/cm33_s_signed_fw/proj_cm33_s_signed.hex"
51+
}
52+
],
53+
"outputs" :
54+
[
55+
{
56+
"file" : "../Debug/rtthread.hex",
57+
"format" : "ihex",
58+
"overlap" : "ignore"
59+
}
60+
]
61+
}
62+
]
3563
}
3664
]
3765
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"schema-version": 1.0,
3+
"content": [
4+
{
5+
"name": "relocate_proj_cm33_ns",
6+
"description": "relocate the hex to a programmable (S-BUS) address",
7+
"enabled": true,
8+
"commands": [
9+
{
10+
"command": "hex-relocate",
11+
"inputs": [
12+
{
13+
"file": "../Debug/rtthread.hex",
14+
"regions": [
15+
{ "start": "0x02000000", "size": "0x00080000", "dest": "0x22000000" },
16+
{ "start": "0x04000000", "size": "0x00100000", "dest": "0x24000000" },
17+
{ "start": "0x06000000", "size": "0x00500000", "dest": "0x26000000" },
18+
{ "start": "0x08000000", "size": "0x01000000", "dest": "0x60000000" },
19+
{ "start": "0x0C000000", "size": "0x01000000", "dest": "0x64000000" },
20+
{ "start": "0x12000000", "size": "0x00080000", "dest": "0x32000000" },
21+
{ "start": "0x14000000", "size": "0x00100000", "dest": "0x34000000" },
22+
{ "start": "0x16000000", "size": "0x00500000", "dest": "0x36000000" },
23+
{ "start": "0x18000000", "size": "0x01000000", "dest": "0x70000000" },
24+
{ "start": "0x1C000000", "size": "0x01000000", "dest": "0x74000000" }
25+
]
26+
}
27+
],
28+
"outputs": [
29+
{
30+
"file": "../Debug/rtthread.hex"
31+
}
32+
]
33+
}
34+
]
35+
},
36+
{
37+
"name": "merge",
38+
"description": "combine individual project hex files into a single hex",
39+
"enabled": true,
40+
"commands" :
41+
[
42+
{
43+
"command" : "merge",
44+
"inputs" :
45+
[
46+
{
47+
"file" : "../Debug/rtthread.hex"
48+
},
49+
{
50+
"file" : "../../../tools/edgeprotecttools/cm33_s_signed_fw/proj_cm33_s_signed.hex"
51+
}
52+
],
53+
"outputs" :
54+
[
55+
{
56+
"file" : "../Debug/rtthread.hex",
57+
"format" : "ihex",
58+
"overlap" : "ignore"
59+
}
60+
]
61+
}
62+
]
63+
}
64+
]
65+
}

projects/Edgi-Talk_Audio/Edgi_Talk_M33_Audio/SConstruct

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ except Exception as e:
2222
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
2323

2424
DefaultEnvironment(tools=[])
25-
env = Environment(tools = ['mingw'],
25+
env = Environment(tools = ['mingw'], ENV=os.environ,
2626
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
2727
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
2828
AR = rtconfig.AR, ARFLAGS = '-rc',
2929
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
3030
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
3131
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
3232

33+
OBJCOPY = os.path.join(rtconfig.EXEC_PATH, 'arm-none-eabi-objcopy')
34+
3335
if rtconfig.PLATFORM in ['iccarm']:
3436
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
3537
env.Replace(ARFLAGS = [''])
@@ -131,3 +133,25 @@ else:
131133

132134
# make a building
133135
DoBuilding(TARGET, objs)
136+
137+
# Generate HEX file
138+
DEBUG_DIR = '../Debug'
139+
if not os.path.exists(DEBUG_DIR):
140+
os.makedirs(DEBUG_DIR)
141+
hex_file = env.Command(DEBUG_DIR + '/rtthread.hex', TARGET, OBJCOPY + ' -O ihex $SOURCE $TARGET')
142+
143+
# Secure image packaging using edgeprotecttools (Windows only)
144+
if platform.system() == 'Windows':
145+
EDGEPROTECTTOOLS = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(SDK_ROOT))), 'tools', 'edgeprotecttools', 'bin', 'edgeprotecttools.exe')
146+
BOOT_CONFIG = os.path.join(SDK_ROOT, 'config', 'boot_with_extended_boot_scons.json')
147+
148+
if os.path.exists(EDGEPROTECTTOOLS) and os.path.exists(BOOT_CONFIG):
149+
secure_image = env.Command(
150+
'secure_image', # Pseudo target
151+
hex_file,
152+
'"' + EDGEPROTECTTOOLS + '" run-config -i "' + BOOT_CONFIG + '"'
153+
)
154+
else:
155+
print("edgeprotecttools or boot config not found, skipping secure image packaging")
156+
print("EDGEPROTECTTOOLS:", EDGEPROTECTTOOLS)
157+
print("BOOT_CONFIG:", BOOT_CONFIG)

projects/Edgi-Talk_Audio/Edgi_Talk_M33_Audio/config/boot_with_extended_boot.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,34 @@
3232
]
3333
}
3434
]
35+
},
36+
{
37+
"name": "merge",
38+
"description": "combine individual project hex files into a single hex",
39+
"enabled": true,
40+
"commands" :
41+
[
42+
{
43+
"command" : "merge",
44+
"inputs" :
45+
[
46+
{
47+
"file" : "../Debug/rtthread.hex"
48+
},
49+
{
50+
"file" : "../tools/edgeprotecttools/cm33_s_signed_fw/proj_cm33_s_signed.hex"
51+
}
52+
],
53+
"outputs" :
54+
[
55+
{
56+
"file" : "../Debug/rtthread.hex",
57+
"format" : "ihex",
58+
"overlap" : "ignore"
59+
}
60+
]
61+
}
62+
]
3563
}
3664
]
3765
}

0 commit comments

Comments
 (0)