Skip to content

Conversation

@Robinsssson
Copy link

Hi, I noticed that your project does not currently support the Windows platform, so I have created this pull request to address the issue. I hope it will be helpful to you. 😄

armgcc.lua Outdated
set_toolset("ar", "arm-none-eabi-ar")
set_toolset("as", "arm-none-eabi-gcc")
if is_plat("windows") then
set_toolset("cc", "arm-none-eabi-gcc.exe")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use 4 spaces instead of tab

armgcc.lua Outdated
set_toolset("ld", "arm-none-eabi-gcc")
set_toolset("ar", "arm-none-eabi-ar")
set_toolset("as", "arm-none-eabi-gcc")
if is_plat("windows") then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should set toolset and call toolchain:is_plat in on_load.

https://github.com/xmake-io/xmake/blob/2c973f5431c7fc907ed52a01698f1dd51804507d/xmake/toolchains/armcc/xmake.lua#L46

on_load(function (toolchain)
    if toolchain:is_plat("windows") then
        toolchain:set("toolset", "cc", "...")
    end
end)

armgcc.lua Outdated
-- io.writefile(gen_fi..".asm", asm)
os.execv("arm-none-eabi-objdump", {"-S", out}, {stdout=gen_fi..".asm"})
os.exec("arm-none-eabi-objcopy -O ihex "..out.." "..gen_fi..".hex")
if is_plat("windows") then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toolchain:is_plat

armgcc.lua Outdated
os.execv("arm-none-eabi-objdump", {"-S", out}, {stdout=gen_fi..".asm"})
os.exec("arm-none-eabi-objcopy -O ihex "..out.." "..gen_fi..".hex")
if is_plat("windows") then
os.exec("arm-none-eabi-objcopy.exe -Obinary "..out.." "..gen_fi..".bin")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add spaces .. out ..

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and please use os.execv

armgcc.lua Outdated
-- os.exec("arm-none-eabi-objdump -S "..out.." > "..gen_fi..".asm")
-- local asm = os.iorun("arm-none-eabi-objdump -S build/cross/cortex-m4/release/minimal-proj")
-- io.writefile(gen_fi..".asm", asm)
os.execv("arm-none-eabi-objdump.exe", {"-S", out}, {stdout=gen_fi..".asm"})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add spaces =

@Robinsssson
Copy link
Author

Thank you, I will address the issues you've mentioned.

arm-gcc.lua Outdated
-- os.exec("arm-none-eabi-objdump -S "..out.." > "..gen_fi..".asm")
-- local asm = os.iorun("arm-none-eabi-objdump -S build/cross/cortex-m4/release/minimal-proj")
-- io.writefile(gen_fi..".asm", asm)
if is_plat("windows") then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target:is_plat

"directory": "d:\\project\\stm32-example-project",
"arguments": ["arm-none-eabi-gcc.exe", "-c", "-specs=nano.specs", "-mcpu=cortex-m4", "-mthumb", "-mfloat-abi=hard", "-mfpu=fpv4-sp-d16", "-fdata-sections", "-ffunction-sections", "-nostartfiles", "-Os", "-o", "build\\.objs\\minimal-proj\\cross\\cortex-m4\\release\\src\\startup.c.o", "src\\startup.c"],
"file": "src\\startup.c"
}]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file

arm-gcc.lua Outdated
rule("generate-hex")
after_build(function(target)
print("$(env ARM_TOOL)")
print("after_build: generate hex files")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove log


on_run(function()
print("Run binary in Qemu!")
local bin_out = os.files("$(buildir)/*.bin")[1]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use import("lib.detect.find_file") instead of os.files, and use core.project.config + config.buildir() instead of $(buildir)

print("Run binary in Qemu!")
local bin_out = os.files("$(buildir)/*.bin")[1]
if bin_out then
os.exec("qemu-system-arm -M stm32-p103 -nographic -kernel " .. bin_out)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.execv

if bin_out then
os.exec("qemu-system-arm -M stm32-p103 -nographic -kernel " .. bin_out)
else
print("Do not find bin file in $(buildir)/")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use raise()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants