SD Card as swap

Hello,
I was wondering if it's possible to use the MicroSD card on the ethernet shield as swap memory? It doesn't have to be system wide, just for my program. Does anyone know if this is possible? It seems like it is, but it just hasn't been implemented before.

Thanks,
Aaron

What do you mean by swap? The ATmega doesn't have a memory system like a PC.

By swap I mean where it can use the SD card as ram.

You can call it swap, but isn't this the same as saving variables in a file on the SD card instead of the RAM?
You will have to write a bit of code to handle this "swap" though.

This is what I mean by swap: Memory paging - Wikipedia

I'm not sure, but I'm pretty sure I'll have to hack away at the firmware to accomplish this. I might be able to do it from the place where the user code is stored and executed, not sure.

The hardware doesn't support page faults, so what is described on that page doesn't really apply.

Nor can you swap out code because code is stored in flash memory, and can't be changed on the fly.

What you could conceivably do is use an SD card as "extra storage", effectively people do that now for data logging applications etc.

I did a post here about just adding more SRAM via SPI:

SD cards use SPI anyway, so effectively it is a very similar idea.

You could also look at Rugged Circuits MegaRAM shield - you need a Mega for that, since that supports the addressing required. That maps an extra 128 Kb of RAM into your address space.

https://shop.ruggedcircuits.com/index.php?main_page=product_info&cPath=4&products_id=41

You can swap what is in your SRAM with external storage. A good MCU block size is 32 bytes.
SPI RAM is your friend. If the SD is an MCU HD then SPI RAM is the MCU SSD.

The 23K640-I/P 64k SPI Bus Serial RAM (8k x 8 bits = 64k bits) shown here is a standard through-hole DIP:

Using SPI daisy chain you can add as many as you want, and can power. The 256k bit version is surface mount. I know because I have a few of each. 8k bytes for 70 Cents! However there is a small shipping charge and give it time to arrive direct from Hong Kong.
\

Thanks for the information, guys! I'll defiantly look into these solutions. Also, I see that MAX_SOCK_NUM is defined as 4 in w5100.h, is this the hardware limit or can it be raised?