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