make.py 添加反汇编输出
This commit is contained in:
15
make.py
15
make.py
@@ -23,6 +23,7 @@ AS = CC + ' -x assembler-with-cpp'
|
|||||||
|
|
||||||
HEX = 'arm-none-eabi-objcopy' + ' -O ihex'
|
HEX = 'arm-none-eabi-objcopy' + ' -O ihex'
|
||||||
BIN = 'arm-none-eabi-objcopy' + ' -O binary -S'
|
BIN = 'arm-none-eabi-objcopy' + ' -O binary -S'
|
||||||
|
OD = 'arm-none-eabi-objdump' + ' -dS'
|
||||||
|
|
||||||
CSRC = []
|
CSRC = []
|
||||||
|
|
||||||
@@ -43,7 +44,15 @@ BUILD_DIR = 'build'
|
|||||||
TARGET = 'hello'
|
TARGET = 'hello'
|
||||||
|
|
||||||
CFLAG = [
|
CFLAG = [
|
||||||
"-Wall -pedantic -specs=nano.specs -mcpu=cortex-m4 -mthumb -lc -lm -lnosys -Og -Tstm32_app.ld",
|
"-Wall -pedantic -mcpu=cortex-m4 -mthumb -lc -lm -lnosys -Og",
|
||||||
|
"-pie",
|
||||||
|
# "-fPIC",
|
||||||
|
# "-fPIE",
|
||||||
|
"-msingle-pic-base",
|
||||||
|
"-specs=nano.specs",
|
||||||
|
# "-nostdlib -emain",
|
||||||
|
"",
|
||||||
|
"-Tstm32_app.ld",
|
||||||
f"-Wl,-Map={BUILD_DIR}/{TARGET}.map,--cref -Wl,--gc-sections"
|
f"-Wl,-Map={BUILD_DIR}/{TARGET}.map,--cref -Wl,--gc-sections"
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -174,6 +183,9 @@ def build_target(src:list[str]):
|
|||||||
def main():
|
def main():
|
||||||
global CSRC
|
global CSRC
|
||||||
global ASRC
|
global ASRC
|
||||||
|
if(os.path.exists(f"{TARGET}.s")):
|
||||||
|
os.remove(f"{TARGET}.s")
|
||||||
|
|
||||||
CSRC+=find_type('./',['c','C'])
|
CSRC+=find_type('./',['c','C'])
|
||||||
ASRC+=find_type('./',['s','S','asm','ASM'])
|
ASRC+=find_type('./',['s','S','asm','ASM'])
|
||||||
|
|
||||||
@@ -189,6 +201,7 @@ def main():
|
|||||||
build_target(CSRC+ASRC)
|
build_target(CSRC+ASRC)
|
||||||
os.system(f"{HEX} {BUILD_DIR}/{TARGET} {BUILD_DIR}/{TARGET}.hex")
|
os.system(f"{HEX} {BUILD_DIR}/{TARGET} {BUILD_DIR}/{TARGET}.hex")
|
||||||
os.system(f"{BIN} {BUILD_DIR}/{TARGET} {BUILD_DIR}/{TARGET}.bin")
|
os.system(f"{BIN} {BUILD_DIR}/{TARGET} {BUILD_DIR}/{TARGET}.bin")
|
||||||
|
os.system(f"{OD} {BUILD_DIR}/{TARGET} > {TARGET}.s")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user