Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: mark some segments as READONLY #2490

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions CI/build/arduino-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@
sketch_options = {} # key: sketch pattern, value: options
na_sketch_pattern = {} # key: board name, value: sketch pattern list

all_warnings = False

# Counter
nb_build_passed = 0
nb_build_failed = 0
nb_build_skipped = 0
nb_warnings = 0

# Timing
full_buildTime = time.time()
Expand All @@ -95,7 +94,7 @@
overflow_pattern = re.compile(
r"(will not fit in |section .+ is not within )?region( .+ overflowed by [\d]+ bytes)?"
)

warning_pattern = re.compile(r"warning: .+LOAD segment with RWX permissions")
# format
build_format_header = "| {:^8} | {:42} | {:^10} | {:^7} |"
build_format_result = "| {:^8} | {:42} | {:^19} | {:^6.2f}s |"
Expand Down Expand Up @@ -590,11 +589,18 @@ def find_board():
def check_status(status, build_conf, boardKo, nb_build_conf):
global nb_build_passed
global nb_build_failed
global nb_warnings
sketch_name = build_conf[idx_cmd][-1].name

if status[1] == 0:
result = fsucc
nb_build_passed += 1
# Check warnings
logFile = build_conf[idx_log] / f"{sketch_name}.log"
for i, line in enumerate(open(logFile)):
if warning_pattern.search(line):
nb_warnings += 1
print(f"Warning: {line}")
elif status[1] == 1:
# Check if failed due to a region overflowed
logFile = build_conf[idx_log] / f"{sketch_name}.log"
Expand All @@ -608,7 +614,11 @@ def check_status(status, build_conf, boardKo, nb_build_conf):
elif ld_pattern.search(line):
# If one ld line is not for region overflowed --> failed
if overflow_pattern.search(line) is None:
error_found = True
if warning_pattern.search(line):
nb_warnings += 1
print(f"Warning: {line}")
else:
error_found = True
else:
overflow_found = True
if error_found:
Expand Down Expand Up @@ -692,6 +702,8 @@ def log_final_result():
sfail = f"{nb_build_failed} failed ({stat_failed}%)"
sskip = f"{nb_build_skipped} skipped)"
f.write(f"{ssucc}, {sfail} of {nb_build_total} builds ({sskip})\n")
if nb_warnings:
f.write(f"Total warning to remove: {nb_warnings}\n")
f.write(f"Ends {time.strftime('%A %d %B %Y %H:%M:%S')}\n")
f.write(f"Duration: {duration}\n")
f.write(f"Logs are available here:\n{output_dir}\n")
Expand All @@ -702,6 +714,8 @@ def log_final_result():
sfail = f"{nb_build_failed} {ffail} ({stat_failed}%)"
sskip = f"{nb_build_skipped} {fskip}"
print(f"Builds Summary: {ssucc}, {sfail} of {nb_build_total} builds ({sskip})")
if nb_warnings:
print(f"Total warning to remove: {nb_warnings}")
print(f"Duration: {duration}")
print("Logs are available here:")
print(output_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -108,7 +108,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -118,7 +118,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
10 changes: 5 additions & 5 deletions variants/STM32C0xx/C031C(4-6)(T-U)/ldscript.ld
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -100,7 +100,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -110,7 +110,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
10 changes: 5 additions & 5 deletions variants/STM32F0xx/F030C6T/ldscript.ld
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -108,7 +108,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -118,7 +118,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
10 changes: 5 additions & 5 deletions variants/STM32F0xx/F030C8T/ldscript.ld
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -100,7 +100,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -110,7 +110,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
10 changes: 5 additions & 5 deletions variants/STM32F0xx/F030F4P/ldscript.ld
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -100,7 +100,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -110,7 +110,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
10 changes: 5 additions & 5 deletions variants/STM32F0xx/F030K6T/ldscript.ld
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -108,7 +108,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -118,7 +118,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
10 changes: 5 additions & 5 deletions variants/STM32F0xx/F030R8T/ldscript.ld
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab : {
.ARM.extab (READONLY) : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM : {
.ARM (READONLY) : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -100,7 +100,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -110,7 +110,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
Loading
Loading