# HiFive1 Rev B copy from flash to RAM

**URL:** <https://forums.sifive.com/t/hifive1-rev-b-copy-from-flash-to-ram/4350>\
**Category:** HiFive1 Rev B\
**Created:** [January 7, 2021, 12:54pm UTC](https://forums.sifive.com/t/hifive1-rev-b-copy-from-flash-to-ram/4350 "2021-01-07T12:54:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsvtgc](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsvtgc](https://forums.sifive.com/u/bsvtgc)\
**Post date:** [January 7, 2021, 12:54pm UTC](https://forums.sifive.com/t/hifive1-rev-b-copy-from-flash-to-ram/4350/1 "2021-01-07T12:54:28Z")

</div>

FE310 manual reads the following:

_FE310-G000 fetches the first instruction out of reset from 0x1000. The instruction stored there_  
_jumps straight to OTP at 0x2\_0000, and will either enter a trap loop if the OTP is not programmed,_  
_or start running the OTP code._

I see my application is stored at 0x2001\_0f84 (freedom studio environment, Jilnk, MacOS) which belongs to external flash in memory map & I also see flash in schematics. So OTP (primary boot loader) set things up and jumps into flash. Is it right?

Further, is this XIP? (from address, it seems to be but seek confirmation)  
what changes would copy my application from SPI Flash to RAM and execute from RAM?

---

<div class="post-metadata">

**Author:** ![dconn](https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/32.png) [@dconn](https://forums.sifive.com/u/dconn)\
**Post date:** [January 8, 2021, 7:25pm UTC](https://forums.sifive.com/t/hifive1-rev-b-copy-from-flash-to-ram/4350/2 "2021-01-08T19:25:21Z")

</div>

Hi,

Your linker script file (.lds) controls the map of your code so if you are running on the Arty and building your code with metal.default.lds this will map things to SPI flash. You can alternatively use metal.scratchpad.lds to place your code into RAM. When using Freedom Studio this linker script selection is found in the Makefile like this: LINK\_TARGET = default. Change this to LINK\_TARGET = scratchpad and code will be placed in RAM and the debugger tools will download and start executing there.

Thanks
