解决lb lh 指令没有进行符号扩展的问题

This commit is contained in:
2025-04-17 23:36:44 +08:00
parent 46d1e933f5
commit 29019b9b98
9 changed files with 166 additions and 22 deletions

18
make.py
View File

@@ -33,16 +33,16 @@ ASRC = []
BUILD_DIR = 'build'
TARGET = 'hello.exe'
TARGET = 'hello'
# CFLAG = ["-Wall -pedantic -specs=nano.specs -mcpu=cortex-m3 -mthumb -lc -lm -lnosys -Og -Tstm32_boot.ld",
# f"-Wl,-Map={BUILD_DIR}/{TARGET}.map,--cref -Wl,--gc-sections"]
# -pedantic 这一项是ISO语法检验
CFLAG = ["-Wall -g"]
CFLAG = ["-Wall -g","-pthread"]
# 找到指定后缀的文件
def find_type(path:str,fix:list[str]):
def find_type(path:str,fix:list):
dlist=os.listdir(path)
file_list=[]
for i in dlist:
@@ -82,7 +82,7 @@ def tran_path(path:str):
# 判断是否需要重新生成
def check_rebuild(dst:str,src:list[str]):
def check_rebuild(dst:str,src:list):
# print(f"src:{src}")
if(not os.path.exists(dst)):
return True
@@ -118,7 +118,7 @@ def read_depend_files(name:str):
# 生成依赖关系
def build_depend(src:list[str]):
def build_depend(src:list):
flags=f"{' '.join(CINC)} {' '.join(CDEF)} {' '.join(CFLAG)}"
for i in src:
name=tran_path(i).split('.')[0]
@@ -134,7 +134,7 @@ def build_depend(src:list[str]):
print(f"{i} 没有更新源文件")
# 生成中间文件
def build_object(src:list[str]):
def build_object(src:list):
flags=f"{' '.join(CINC)} {' '.join(CDEF)} {' '.join(CFLAG)}"
for i in src:
name_l=tran_path(i).split('.')
@@ -164,7 +164,7 @@ def build_object(src:list[str]):
# 生成可执行文件
def build_target(src:list[str]):
def build_target(src:list):
flags=f"{' '.join(CINC)} {' '.join(CDEF)} {' '.join(CFLAG)}"
obj_list=[]
for i in src:
@@ -184,8 +184,8 @@ def build_target(src:list[str]):
def main():
global CSRC
global ASRC
CSRC+=find_type('.\\soft',['c','C'])
CSRC+=find_type('.\\cpu',['c','C'])
CSRC+=find_type('soft',['c','C'])
CSRC+=find_type('cpu',['c','C'])
# ASRC+=find_type('./',['s','S','asm','ASM'])
if(not os.path.exists(BUILD_DIR)):