From 6bb3ccf822cfb5b50161cb05d5c43377f54cdfb6 Mon Sep 17 00:00:00 2001 From: Graham Sanderson Date: Thu, 21 Nov 2024 11:56:22 -0600 Subject: [PATCH] some minor pioasm fixes for #1950 (#2056) --- tools/pioasm/c_sdk_output.cpp | 2 +- tools/pioasm/gen/parser.cpp | 4 ++-- tools/pioasm/parser.yy | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/pioasm/c_sdk_output.cpp b/tools/pioasm/c_sdk_output.cpp index f54fabcd9..c1730db4c 100644 --- a/tools/pioasm/c_sdk_output.cpp +++ b/tools/pioasm/c_sdk_output.cpp @@ -109,7 +109,7 @@ struct c_sdk_output : public output_format { fprintf(out, " .instructions = %sprogram_instructions,\n", prefix.c_str()); fprintf(out, " .length = %d,\n", (int) program.instructions.size()); fprintf(out, " .origin = %d,\n", program.origin.get()); - fprintf(out, " .pio_version = %d,\n", program.pio_version); + fprintf(out, " .pio_version = %spio_version,\n", prefix.c_str()); fprintf(out, "#if PICO_PIO_VERSION > 0\n"); fprintf(out, " .used_gpio_ranges = 0x%x\n", program.used_gpio_ranges); fprintf(out, "#endif\n"); diff --git a/tools/pioasm/gen/parser.cpp b/tools/pioasm/gen/parser.cpp index 7027d2165..d75e8afbe 100644 --- a/tools/pioasm/gen/parser.cpp +++ b/tools/pioasm/gen/parser.cpp @@ -1127,7 +1127,7 @@ namespace yy { break; case 22: // directive: ".in" value direction autop threshold - { pioasm.get_current_program(yystack_[4].location, ".out", true).set_in(yylhs.location, yystack_[3].value.as < std::shared_ptr > (), yystack_[2].value.as < bool > (), yystack_[1].value.as < bool > (), yystack_[0].value.as < std::shared_ptr > ()); } + { pioasm.get_current_program(yystack_[4].location, ".in", true).set_in(yylhs.location, yystack_[3].value.as < std::shared_ptr > (), yystack_[2].value.as < bool > (), yystack_[1].value.as < bool > (), yystack_[0].value.as < std::shared_ptr > ()); } break; case 23: // directive: ".out" value direction autop threshold @@ -1135,7 +1135,7 @@ namespace yy { break; case 24: // directive: ".set" value - { pioasm.check_version(1, yylhs.location, ".in"); pioasm.get_current_program(yystack_[1].location, ".out", true).set_set_count(yylhs.location, yystack_[0].value.as < std::shared_ptr > ()); } + { pioasm.get_current_program(yystack_[1].location, ".set", true).set_set_count(yylhs.location, yystack_[0].value.as < std::shared_ptr > ()); } break; case 25: // directive: ".wrap_target" diff --git a/tools/pioasm/parser.yy b/tools/pioasm/parser.yy index df05f5f7d..730bc9205 100644 --- a/tools/pioasm/parser.yy +++ b/tools/pioasm/parser.yy @@ -199,9 +199,9 @@ directive: | SIDE_SET value OPTIONAL { pioasm.get_current_program(@1, ".side_set", true).set_sideset(@$, $2, true, false); } | SIDE_SET value PINDIRS { pioasm.get_current_program(@1, ".side_set", true).set_sideset(@$, $2, false, true); } | SIDE_SET value { pioasm.get_current_program(@1, ".side_set", true).set_sideset(@$, $2, false, false); } - | DOT_IN value direction autop threshold { pioasm.get_current_program(@1, ".out", true).set_in(@$, $2, $3, $4, $5); } + | DOT_IN value direction autop threshold { pioasm.get_current_program(@1, ".in", true).set_in(@$, $2, $3, $4, $5); } | DOT_OUT value direction autop threshold { pioasm.get_current_program(@1, ".out", true).set_out(@$, $2, $3, $4, $5); } - | DOT_SET value { pioasm.check_version(1, @$, ".in"); pioasm.get_current_program(@1, ".out", true).set_set_count(@$, $2); } + | DOT_SET value { pioasm.get_current_program(@1, ".set", true).set_set_count(@$, $2); } | WRAP_TARGET { pioasm.get_current_program(@1, ".wrap_target").set_wrap_target(@$); } | WRAP { pioasm.get_current_program(@1, ".wrap").set_wrap(@$); } | WORD value { pioasm.get_current_program(@1, "instruction").add_instruction(std::shared_ptr(new instr_word(@$, $2))); }