# Running code off a SD Card

**URL:** <https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109>\
**Category:** General Guidance\
**Created:** [July 7, 2022, 5:57am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109 "2022-07-07T05:57:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [July 7, 2022, 5:57am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/1 "2022-07-07T05:57:12Z")

</div>

I'm creating a basic arduino Smart device (doesn't connect to internet _YET_), but I think the code will be so big I won't be able to fit it all on my Mega2560. Am I able to put the code on a SD Card and tell my board to run the code on the SD card, or is that not feasible?  
I am planning on having quite a few "apps" running on it (one at a time of course), but each "app" might be HUGE.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [July 7, 2022, 6:02am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/2 "2022-07-07T06:02:02Z")

</div>

> [@outbackhut](#):
>
> Am I able to put the code on a SD Card and tell my board to run the code on the SD card,

No. You cannot put code on the SD card, load it and run it

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [July 7, 2022, 6:03am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/3 "2022-07-07T06:03:37Z")

</div>

Consider using a raspberry pi zero W?

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [July 7, 2022, 6:03am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/4 "2022-07-07T06:03:52Z")

</div>

@UKHeliBob  
How do you suggest running absolutely massive code then?  
I already have some example code that is 308% of Mega dynamic storage.

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [July 7, 2022, 6:05am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/5 "2022-07-07T06:05:12Z")

</div>

@PaulRB  
Can I program raspberry pi with c++??  
Can I connect a tft lcd to a raspberry pi zero W??  
Can I use any arduino module or shield with raspberry pi??

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [July 7, 2022, 6:08am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/6 "2022-07-07T06:08:48Z")

</div>

You can code raspberry pi in many languages including C++.

You can attach TFT displays.

Some modules designed for Arduino can be attached to raspberry pi, but not all. Attaching a shield might be possible but does not sound sensible. What modules and shields do you plan to use? Please post links to the specs of those modules.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [July 7, 2022, 6:10am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/7 "2022-07-07T06:10:40Z")

</div>

> [@outbackhut](#):
>
> How do you suggest running absolutely massive code then?

Optimise your code. As we can't see it, we can't advise.

If push comes to shove, get a more capable processor.

> [@outbackhut](#):
>
> I already have some example code that is 308% of Mega dynamic storage.

That does not say anything about the actual program.

You probably have stuff in RAM that can easily be moved to other locations. If you have e.g. bitmaps, those can be stored in either flash or on a SD card. Another one can be make (more) use of the F macro (although I don't think it will be enough on its own to get down to around 75% of dybnamic memory).

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [July 7, 2022, 6:14am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/8 "2022-07-07T06:14:15Z")

</div>

$106.00??????????????????????????  
No way!!

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [July 7, 2022, 6:15am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/9 "2022-07-07T06:15:26Z")

</div>

What is $106? Post a link.

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [July 7, 2022, 6:15am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/10 "2022-07-07T06:15:51Z")

</div>

> **[Amazon.com: Raspberry Pi Zero 2 W (Wireless / Bluetooth) 2021 (RPi Zero 2W) :...](https://www.amazon.com/Raspberry-Zero-Bluetooth-RPi-2W/dp/B09LH5SBPS)**
>
> Amazon.com: Raspberry Pi Zero 2 W (Wireless / Bluetooth) 2021 (RPi Zero 2W) : Electronics

Everyone else is sold out!!

---

<div class="post-metadata">

**Author:** ![outbackhut](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/outbackhut/32/1099892_2.png) [@outbackhut](https://forum.arduino.cc/u/outbackhut)\
**Post date:** [July 7, 2022, 6:17am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/11 "2022-07-07T06:17:14Z")

</div>

Can I not do this:

[![](https://europe1.discourse-cdn.com/arduino/original/4X/7/a/c/7aca53b340ef57af3a7eb359ec6a26885fb61c32.jpeg "Gamebuino - load games from SD card - arduino bootloader") ](https://www.youtube.com/watch?v=kh0PRjo7s8g)

What about bitlash?

---

<div class="post-metadata">

**Author:** ![Grumpy\_Mike](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/grumpy_mike/32/213521_2.png) [@Grumpy\_Mike](https://forum.arduino.cc/u/Grumpy_Mike)\
**Post date:** [July 7, 2022, 6:21am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/12 "2022-07-07T06:21:42Z")

</div>

> [@outbackhut](#):
>
> $106.00

What costs that? And where do you live?  
They are less than £10 here.

> **[Raspberry Pi Zero W](https://thepihut.com/products/raspberry-pi-zero-w)**
>
> The latest edition to the Raspberry Pi Zero family. Introducing the Raspberry Pi Zero W - now with built in WiFi and Bluetooth. Official UK distributor

> [@outbackhut](#):
>
> Am I able to put the code on a SD Card and tell my board to run the code on the SD card, or is that not feasible?

As said before it is not feasible for a C program.  
However, there is a language called BitLash which can be read and run off an SD card.  
[BitLash](http://bitlash.net/)  
It is a text based interpreted language so it won't have the same speed as C code, which is compiled to machine code before running.

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [July 7, 2022, 6:30am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/13 "2022-07-07T06:30:55Z")

</div>

Hello [Grumpy\_Mike](https://forum.arduino.cc/u/Grumpy_Mike)  
Many many thanks for the link to BitLash.

---

<div class="post-metadata">

**Author:** ![tepalia02](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tepalia02](https://forum.arduino.cc/u/tepalia02)\
**Post date:** [July 7, 2022, 6:33am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/14 "2022-07-07T06:33:05Z")

</div>

Code should be uploaded to the Arduino. There is no way to put the code in SD card. If 512 KB is sufficient, switch to Arduino due. If that is not enough, consider switching to Raspberry Pi.

---

<div class="post-metadata">

**Author:** ![spetru](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@spetru](https://forum.arduino.cc/u/spetru)\
**Post date:** [July 7, 2022, 6:44am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/15 "2022-07-07T06:44:17Z")

</div>

You can code the raspberry pi with C++ and Phyton. For C++, you can use the Arduino IDE

---

<div class="post-metadata">

**Author:** ![spetru](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@spetru](https://forum.arduino.cc/u/spetru)\
**Post date:** [July 7, 2022, 6:46am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/16 "2022-07-07T06:46:15Z")

</div>

You can use the Pico W who is better at memory, it is 6€ and it can connect to the internet

---

<div class="post-metadata">

**Author:** ![spetru](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@spetru](https://forum.arduino.cc/u/spetru)\
**Post date:** [July 7, 2022, 6:52am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/17 "2022-07-07T06:52:03Z")

</div>

It is 14€/12£

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [July 7, 2022, 7:02am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/18 "2022-07-07T07:02:25Z")

</div>

> [@Grumpy\_Mike](#):
>
> They are less than £10 here.

But not available! I checked a couple of the usual suppliers. Nothing except Pico.

Clearly the supplier found by @outbackhut knows they are one of very few with any stock and are profiteering.

---

<div class="post-metadata">

**Author:** ![madmark2150](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@madmark2150](https://forum.arduino.cc/u/madmark2150)\
**Post date:** [July 7, 2022, 7:03am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/19 "2022-07-07T07:03:22Z")

</div>

Why not? Load it as a byte array and call the array pointer address. As long as it's self contained and ends in a return it SHOULD work. Or am I missing something?

---

<div class="post-metadata">

**Author:** ![spetru](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@spetru](https://forum.arduino.cc/u/spetru)\
**Post date:** [July 7, 2022, 7:05am UTC](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109/20 "2022-07-07T07:05:10Z")

</div>

Yes but the Pico W it's good, too. Plus it can connect to the internet and have more memory

[Next page](https://forum.arduino.cc/t/running-code-off-a-sd-card/1010109.md?page=2)
