pioasm: document predefined constants zero and one #1951

Open
opened 2024-09-25 08:17:44 -05:00 by magy00 · 1 comment
magy00 commented 2024-09-25 08:17:44 -05:00 (Migrated from github.com)

Resubmission of #1862:

Error messages are not obvious. Maybe allow zero and one to be assigned the values 0 and 1, resp., repeatedly.

test.pio:

.program test
.origin 0
_0:
zero:
        jmp skip
_1:
one:
        mov pins, ~pins
skip:

        nop [1]

        out pc, 1       // effectively jmp _0 or jmp _1
$ ~/.pico-sdk/tools/2.0.0/pioasm/pioasm test.pio
test.pio:4.1-4: syntax error, unexpected integer
    4 | zero:
      | ^~~~
test.pio:7.1-3: syntax error, unexpected integer
    7 | one:
      | ^~~

Similar for (obvious?) labels like clear, wait, status, etc., are mistaken as keywords:

test.pio:

.program test
clear:
wait:
status:
block:
$ ~/.pico-sdk/tools/2.0.0/pioasm/pioasm test.pio
test.pio:2.1-5: syntax error, unexpected clear
    2 | clear:
      | ^~~~~

Note that all (except for a generated #define) is case-insensitive (cannot use kludges like all-caps in CPP).

Apparently reserved words:

.clock_div .define .fifo .in .lang_opt .mov_status .origin .out .pio_version .program .set .side_set .word .wrap .wrap_target
auto block clear exec gpio ifempty iffull in irq isr jmp jmppin left manual mov next noblock nop nowait null one opt optional osr osre out pc pin pindirs pins prev public pull push putget rel right rp2040 rp2350 rx rxfifo set side side_set sideset status tx txfifo txget txput txrx wait x y zero

[Resubmission](https://forums.raspberrypi.com/viewtopic.php?t=375543) of [#1862](https://github.com/raspberrypi/pico-sdk/issues/1862): Error messages are not obvious. Maybe allow `zero` and `one` to be assigned the values `0` and `1`, resp., repeatedly. test.pio: ``` .program test .origin 0 _0: zero: jmp skip _1: one: mov pins, ~pins skip: nop [1] out pc, 1 // effectively jmp _0 or jmp _1 ``` ``` $ ~/.pico-sdk/tools/2.0.0/pioasm/pioasm test.pio test.pio:4.1-4: syntax error, unexpected integer 4 | zero: | ^~~~ test.pio:7.1-3: syntax error, unexpected integer 7 | one: | ^~~ ``` Similar for (obvious?) labels like `clear`, `wait`, `status`, etc., are mistaken as keywords: test.pio: ``` .program test clear: wait: status: block: ``` ``` $ ~/.pico-sdk/tools/2.0.0/pioasm/pioasm test.pio test.pio:2.1-5: syntax error, unexpected clear 2 | clear: | ^~~~~ ``` Note that all (except for a generated `#define`) is case-insensitive (cannot use kludges like all-caps in `CPP`). Apparently reserved words: .clock_div .define .fifo .in .lang_opt .mov_status .origin .out .pio_version .program .set .side_set .word .wrap .wrap_target auto block clear exec gpio ifempty iffull in irq isr jmp jmppin left manual mov next noblock nop nowait null one opt optional osr osre out pc pin pindirs pins prev public pull push putget rel right rp2040 rp2350 rx rxfifo set side side_set sideset status tx txfifo txget txput txrx wait x y zero
kilograham commented 2024-11-19 20:46:36 -06:00 (Migrated from github.com)

I had a quick look and couldn't figure out how to easily improve this message (without making a rule to match all tokens followed by a COLON)... assigning to @will-v-pi to see if he has any ideas

possibly punt into 2.2.0 if not

I had a quick look and couldn't figure out how to easily improve this message (without making a rule to match all tokens followed by a COLON)... assigning to @will-v-pi to see if he has any ideas possibly punt into 2.2.0 if not
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1951
No description provided.