-
Notifications
You must be signed in to change notification settings - Fork 1
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
add feature: add support in windows platform #1
base: master
Are you sure you want to change the base?
Conversation
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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces .. out ..
There was a problem hiding this comment.
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"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces =
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target:is_plat
.vscode/compile_commands.json
Outdated
"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" | ||
}] |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use raise()
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. 😄