From c23dfd116ab91a84f3f41a789e93a77802fdb06d Mon Sep 17 00:00:00 2001 From: Old-Ding <35417409+Old-Ding@users.noreply.github.com> Date: Mon, 6 Jul 2026 01:25:20 +0800 Subject: [PATCH] bsp: Use raw regex strings in upgrade tools Python warns about invalid escape sequences in the heap update regex patterns. Mark the patterns as raw strings so the regex values stay unchanged without relying on invalid Python escapes. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com> --- bsp/Infineon/tools/upgrade.py | 6 +++--- bsp/ft32/tools/upgrade.py | 6 +++--- bsp/mm32/tools/upgrade.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bsp/Infineon/tools/upgrade.py b/bsp/Infineon/tools/upgrade.py index c7e35466d22..6f55bd5c722 100644 --- a/bsp/Infineon/tools/upgrade.py +++ b/bsp/Infineon/tools/upgrade.py @@ -77,7 +77,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法 + re_result = re.match(r'\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x00000000', oldline) @@ -100,7 +100,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法 + re_result = re.match(r'\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x000', oldline) @@ -123,7 +123,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400 + re_result = re.match(r'\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x400', oldline) diff --git a/bsp/ft32/tools/upgrade.py b/bsp/ft32/tools/upgrade.py index 87b596bf3c3..6add0213f1b 100644 --- a/bsp/ft32/tools/upgrade.py +++ b/bsp/ft32/tools/upgrade.py @@ -77,7 +77,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法 + re_result = re.match(r'\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x00000000', oldline) @@ -100,7 +100,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法 + re_result = re.match(r'\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x000', oldline) @@ -123,7 +123,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400 + re_result = re.match(r'\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x400', oldline) diff --git a/bsp/mm32/tools/upgrade.py b/bsp/mm32/tools/upgrade.py index 1ad9a675122..07803ac990b 100644 --- a/bsp/mm32/tools/upgrade.py +++ b/bsp/mm32/tools/upgrade.py @@ -79,7 +79,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法 + re_result = re.match(r'\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x00000000', oldline) @@ -102,7 +102,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法 + re_result = re.match(r'\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x000', oldline) @@ -125,7 +125,7 @@ def heap2zero(path): if line == '': break - re_result = re.match('\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400 + re_result = re.match(r'\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400 if re_result != None: oldline = line newline = re.sub('0[xX][0-9a-fA-F]+','0x400', oldline)