From 721f754454fe1a7fe0e039cd97116a2e723f4376 Mon Sep 17 00:00:00 2001 From: mjaspers2mtu <44484497+mjaspers2mtu@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:56:01 +0200 Subject: [PATCH 1/2] Update assemble.py allow variables to be initialized with hex and binary values, not just integers --- esp32_ulp/assemble.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp32_ulp/assemble.py b/esp32_ulp/assemble.py index 8b79071..e27b87c 100644 --- a/esp32_ulp/assemble.py +++ b/esp32_ulp/assemble.py @@ -246,7 +246,7 @@ def d_global(self, symbol): self.symbols.set_global(symbol) def append_data(self, wordlen, args): - data = [int(arg).to_bytes(wordlen, 'little') for arg in args] + data = [int(arg, 0).to_bytes(wordlen, 'little') for arg in args] self.append_section(b''.join(data)) def d_byte(self, *args): From bf320af12c7924633e62ae6eacb4437e70fac3b3 Mon Sep 17 00:00:00 2001 From: mjaspers2mtu <44484497+mjaspers2mtu@users.noreply.github.com> Date: Mon, 9 Jun 2025 12:58:53 +0200 Subject: [PATCH 2/2] Update assemble.py Using eval_args instead for better compatibility when using expressions --- esp32_ulp/assemble.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp32_ulp/assemble.py b/esp32_ulp/assemble.py index e27b87c..b1e5876 100644 --- a/esp32_ulp/assemble.py +++ b/esp32_ulp/assemble.py @@ -246,7 +246,7 @@ def d_global(self, symbol): self.symbols.set_global(symbol) def append_data(self, wordlen, args): - data = [int(arg, 0).to_bytes(wordlen, 'little') for arg in args] + data = [int(self.opcodes.eval_arg(arg)).to_bytes(wordlen, 'little') for arg in args] self.append_section(b''.join(data)) def d_byte(self, *args):