Skip to content

Commit 04ce6a6

Browse files
committed
Check jmp_pin specified when JMP PIN opcodes used
1 parent 8221a12 commit 04ce6a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ports/raspberrypi/common-hal/rp2pio/StateMachine.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self,
367367
out_loaded = true;
368368
}
369369
}
370+
if (instruction == pio_instr_bits_jmp) {
371+
uint16_t condition = (full_instruction & 0x00e0) >> 5;
372+
if ((condition == 0x6) && (jmp_pin == NULL)) {
373+
mp_raise_ValueError_varg(translate("Missing jmp_pin. Instruction %d jumps on pin"), i);
374+
}
375+
}
370376
if (instruction == pio_instr_bits_wait) {
371377
uint16_t wait_source = (full_instruction & 0x0060) >> 5;
372378
uint16_t wait_index = full_instruction & 0x001f;

0 commit comments

Comments
 (0)