dmantione / swinsid

Source code for the popular SwinSID SID replacement
53 stars 5 forks source link

compile errors on CentOS and Ubuntu #2

Closed penfold42 closed 1 year ago

penfold42 commented 1 year ago

Hi there,

I'm getting the same error on both: CentOS7 with avr-ar --version GNU ar (GNU Binutils) 2.24

Ubuntu 20.04.5 LTS with avr-as --version GNU assembler (GNU Binutils) 2.26.20160125

$ make
cpp -traditional-cpp -I/usr/lib/avr/include/ -D__AVR_ATmega88A__ -D__ASSEMBLER__ SwinSID88_lazy_jones_fix.asm | \
          avr-as -mmcu=atmega88a -o SwinSID88_lazy_jones_fix.o
{standard input}: Assembler messages:
{standard input}: Warning: unknown escape '\s' in string; ignored
SwinSID88_reconstructed.asm:1338: Error: unknown pseudo-op: `.bss'
make: *** [Makefile:18: SwinSID88_lazy_jones_fix.o] Error 1

What have I missed ?

dmantione commented 1 year ago

I regret to say that the Binutils in these distributions are too old. I have modified the .asm files so they are assembled by older GNU assemblers, however, then it still fails on the linker script.

If I simplify the linker script as follows, it works:


OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
OUTPUT_ARCH(avr:4)

MEMORY
{
  rom   (rx)   : ORIGIN = 0, LENGTH = 8192
  sram   (rw!x) : ORIGIN = 0x800100, LENGTH = 1024
  eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 512
  fuse      (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
  lock      (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
  signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
  user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K
  mmcu (rw!x) : ORIGIN = 0x860000, LENGTH = 1K
}

SECTIONS
{
  . = 0x0000;
  .text 0x0000 : { *(.text) } > rom
  .data 0x0e00 : { *(.data) } > rom
  .wavetable 0x1000 : { *(.wavetable) } > rom
  .bss 0x800100 : { *(.bss) } > sram
  .mmcu 0x860000 : { *(.mmcu) } > mmcu
}

(Tested on CentOS 7.)

However, I am not sure whether I should commit this simplification, the formula to calculate the region length is there with a reason.

penfold42 commented 1 year ago

Thanks! on my ubuntu box it builds fine with the small change you committed.

2.26.20160125 is the same version that microchip are distributing at https://www.microchip.com/en-us/tools-resources/develop/microchip-studio/gcc-compilers

I pulled their tar.gz down and not surprisingly this works fine too on both ubuntu and centos7

FWIW (and I know nothing about linker scripts!) Given its a quick download to get it to work on CentOS7, I'd leave the .ld file alone