I connected an SDcard to my Atmega128 Board.
CS,SCK,MOSI,MISO = PB0,PB1,PB2,PB3 -> SDcard
I tried compiling the SD Lib example for Read Write Test - but it always Fails.
I tried a few standard 5V Arduino SDcard / MicroSDcard slots - but same result.
Is the Arduino SD Lib code / Registers compatible with the Atmega128 ?
It seems that the compiling Atmega128 results in using the Arduino328 SPI Pins:
Initializing SD card…
SD:chipSelectPin = 8
SD:SS_PIN = 10
SD:SPI_SCK_PIN = 13
SD:SPI_MOSI_PIN = 11
SD:SPI_MISO_PIN = 12
SD:cardCommand => 255
SD:cardCommand => 255
…
initialization fails !
Sd2PinMap.h is wrong - No Atmega128 definition
… just more Patches that I need to write …
Fixed ... Modified the SD Lib - WORKS !
I also needed and patched :
-
Boards.txt , pins_arduino.h missing pins (still not right - crumbuino128 besides missing Pins - also has misaligned Pins - need to fix more)
-
Xmem - again no Atmeag128 handling/defs etc
Initializing SD card...
SD:chipSelectPin = 8
SD:SS_PIN = 8
SD:SPI_SCK_PIN = 9
SPI_MOSI_PIN = 10
SD:SPI_MISO_PIN = 11
SD:cardCommand() => 1
SD:cardCommand() => 1
SD:cardCommand() => 1
SD:cardCommand() => 1
SD:cardCommand() => 1
SD:cardCommand() => 0
SD:cardCommand() => 0
SD:cardCommand() => 0
SD:cardCommand() => 0
initialization done.
SD:cardCommand() => 0
Writing to test.txt...
SD:cardCommand() => 0
SD:cardCommand() => 0
SD:cardCommand() => 0
SD:cardCommand() => 0
SD:cardCommand() => 0
SD:cardCommand() => 0
done.
test.txt:
SD:cardCommand() => 0
testing 1, 2, 3.
testing 1, 2, 3.
Why not use the MegaCore instead? The SD library are working, the Arduino core is ported to it, and it got Optiboot! 
I am looking into it.
But I have already started in updating the Arduino Libs.