build works
This commit is contained in:
parent
4fdadbf0c5
commit
cecf2d079e
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
build
|
||||
.zig-cache
|
||||
zig-out
|
||||
zig-out
|
||||
.cache
|
@ -39,11 +39,14 @@ add_executable(blink
|
||||
blink.c
|
||||
)
|
||||
|
||||
add_library(zig_library STATIC IMPORTED)
|
||||
set_property(TARGET zig_library PROPERTY IMPORTED_LOCATION ../zig-out/lib/libpicow_zig.a)
|
||||
|
||||
# pull in common dependencies
|
||||
target_link_libraries(blink pico_stdlib)
|
||||
target_link_libraries(blink zig_library pico_stdlib)
|
||||
|
||||
if (PICO_CYW43_SUPPORTED)
|
||||
target_link_libraries(blink pico_cyw43_arch_none)
|
||||
target_link_libraries(blink zig_library pico_cyw43_arch_none)
|
||||
endif()
|
||||
|
||||
# create map/bin/hex file etc.
|
||||
|
23
blink.c
23
blink.c
@ -5,6 +5,8 @@
|
||||
*/
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Pico W devices use a GPIO on the WIFI chip for the LED,
|
||||
// so when building for Pico W, CYW43_WL_GPIO_LED_PIN will be defined
|
||||
@ -41,13 +43,18 @@ void pico_set_led(bool led_on) {
|
||||
#endif
|
||||
}
|
||||
|
||||
extern int32_t add(int32_t a, int32_t b);
|
||||
|
||||
int main() {
|
||||
int rc = pico_led_init();
|
||||
hard_assert(rc == PICO_OK);
|
||||
while (true) {
|
||||
pico_set_led(true);
|
||||
sleep_ms(LED_DELAY_MS);
|
||||
pico_set_led(false);
|
||||
sleep_ms(LED_DELAY_MS);
|
||||
}
|
||||
stdio_init_all();
|
||||
printf("result from zig : %d\n", add(10, 31));
|
||||
return 0;
|
||||
// int rc = pico_led_init();
|
||||
// hard_assert(rc == PICO_OK);
|
||||
// while (true) {
|
||||
// pico_set_led(true);
|
||||
// sleep_ms(LED_DELAY_MS);
|
||||
// pico_set_led(false);
|
||||
// sleep_ms(LED_DELAY_MS);
|
||||
// }
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ pub fn build(b: *std.Build) void {
|
||||
// for actually invoking the compiler.
|
||||
const lib = b.addLibrary(.{
|
||||
.linkage = .static,
|
||||
.name = "blink",
|
||||
.name = "picow_zig",
|
||||
.root_module = lib_mod,
|
||||
});
|
||||
|
||||
@ -49,6 +49,10 @@ pub fn build(b: *std.Build) void {
|
||||
// running `zig build`).
|
||||
b.installArtifact(lib);
|
||||
|
||||
const ninja_build = b.addSystemCommand(&.{"/home/arkitu/.pico-sdk/ninja/v1.12.1/ninja", "-C", "./build"});
|
||||
ninja_build.setName("ninja : build c");
|
||||
|
||||
b.getInstallStep().dependOn(&ninja_build.step);
|
||||
|
||||
// Creates a step for unit testing. This only builds the test executable
|
||||
// but does not run it.
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
// It is redundant to include "zig" in this name because it is already
|
||||
// within the Zig package namespace.
|
||||
.name = "blink",
|
||||
.name = "picow_zig",
|
||||
|
||||
// This is a [Semantic Version](https://semver.org/).
|
||||
// In a future version of Zig it will be used for package deduplication.
|
||||
|
Loading…
Reference in New Issue
Block a user