Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bios/linker: Place .data in sram with initial copy in rom. #567

Merged
merged 3 commits into from
Jun 16, 2020

Conversation

zyp
Copy link
Contributor

@zyp zyp commented Jun 15, 2020

As per #566, .data section is currently located in rom, rendering it read-only. This PR moves .data to sram, leaving initial state in rom that needs to be copied to sram during startup. This means that every crt0.S needs to be updated to fix this.

  • vexriscv: Updated and tested.
  • rocket: Updated and tested.
  • serv: Updated and tested.
  • blackparrot: Identical to rocket, not tested.
  • cv32e40p: Identical to vexriscv, not tested.
  • minerva: Identical to serv, not tested.
  • picorv32: Existing copy code updated, not tested.
  • lm32: Existing copy code updated, not tested.
  • mor1kx: Still needs to be updated.
  • microwatt: Still needs to be updated. Seems to also miss .bss initialization.

Fixes #566.

@gsomlo
Copy link
Collaborator

gsomlo commented Jun 15, 2020

foo

I get the above when building with

litex/litex/boards/targets/nexys4ddr.py --csr-data-width 32 --sys-clk-freq 75e6 \
    --with-ethernet --with-spi-sdcard --cpu-type rocket --cpu-variant linux \
    --integrated-rom-size=0x10000 --build

It eventually boots from either ethernet or sdcard, but the part where memtest results are printed out to the terminal is all scrambled (on the nexs4ddr).

@gsomlo
Copy link
Collaborator

gsomlo commented Jun 15, 2020

works if sram is doubled to accomodate both .data and stack (current 0x1000 size is not enough for both). Suggest s/0x1000/0x2000/ here and here.

Tested on rocket (64bit) and nexys4ddr, works fine otherwise.

@enjoy-digital
Copy link
Owner

Thanks @zyp, @gsomlo. Let's keep #566 open to finish the work and do the changes on the mor1kx, microwatt.

enjoy-digital added a commit that referenced this pull request Jun 18, 2020
cpu/mor1kx: fix .data initialization (follow-up to PR #567)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bios: .data section placed in rom, wrongly ends up acting like .rodata
3 participants