Thank you maxgerhardt,
this is exactly the problem:
- the “Using as” document gives the .equ directive, but it does not work on PlatformIO
- the avr-libc document gives hi8() and lo8() (these were the high and low I was looking for) but they don’t seem work on PlatformIO
I try to compile this:
#define SPL 0x3d ;stack pointer low
#define SPH 0x3e ;stack pointer high
#define RAMEND 0x08ff
MAIN:
LDI R16,hi8(RAMEND) ;line 152
OUT SPH,R16
LDI R16,lo8(RAMEND)
OUT SPL,R16 ;stack pointer
But I get this error:
Processing ATmega328 (platform: atmelavr; board: ATmega328)
-------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega328.html
PLATFORM: Atmel AVR (3.4.0) > ATmega328
HARDWARE: ATMEGA328 16MHz, 2KB RAM, 32KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
- toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/ATmega328/src/main.o
src/main.S: Assembler messages:
src/main.S:152: Error: `)' required
src/main.S:153: Error: `,' required
src/main.S:153: Error: constant value required
src/main.S:153: Error: garbage at end of line
src/main.S:154: Error: `)' required
src/main.S:155: Error: `,' required
src/main.S:155: Error: constant value required
src/main.S:155: Error: garbage at end of line
src/main.S:187: Error: garbage at end of line
src/main.S:189: Error: garbage at end of line
src/main.S:230: Error: garbage at end of line
src/main.S:232: Error: garbage at end of line
*** [.pio/build/ATmega328/src/main.o] Error 1
============================ [FAILED] Took 0.74 seconds ============================
The terminal process "platformio 'run'" terminated with exit code: 1.
Is there an error in my code?