Coder Social home page Coder Social logo

sophgo / zsbl Goto Github PK

View Code? Open in Web Editor NEW
15.0 5.0 30.0 2.84 MB

SOPHGO RISC-V Zero Stage BootLoader

License: GNU General Public License v2.0

Makefile 1.24% C 86.52% Assembly 1.29% HTML 7.20% CSS 0.10% Shell 0.66% Lex 0.25% Yacc 0.42% C++ 1.44% Perl 0.45% Python 0.43%

zsbl's Issues

opensbi firmware format problem

zsbl/plat/sg2042/boot.c

Lines 118 to 122 in 58eb31f

[ID_OPENSBI] = {
.id = ID_OPENSBI,
.name = "0:riscv64/fw_jump.bin",
.addr = OPENSBI_ADDR,
},

zsbl/plat/sg2042/boot.c

Lines 948 to 949 in 58eb31f

jump_to(boot_file[ID_OPENSBI].addr, current_hartid(),
boot_file[ID_DEVICETREE].addr, (unsigned long)&dynamic_info);

The opensbi image used in zsbl is fw_jump.bin. But the format of passing parameters is fw_dynmic. This should be a bug. Need to replace fw_jump.bin with fw_dynamic.bin

Build failure with -fstack-protector

Hi, when using the distro toolchain on my pioneer, I get build failures that are due to the stack protector symbols being unresolved (the compiler enables -fstack-protector by default). For example,

ld -r -o libzsbl.a --whole-archive common/built-in.a arch/riscv/src/built-in.a drivers/built-in.a lib/built-in.a plat/built-in.a test/built-in.a --no-whole-archive
/usr/lib/gcc/riscv64-unknown-linux-musl/14/../../../../riscv64-unknown-linux-musl/bin/ld: drivers/sd/mmc.o: in function `mmc_send_cmd':
/home/mjo/src/zsbl.git/build/../drivers/sd/mmc.c:40:(.text.mmc_send_cmd+0x8): undefined reference to `__stack_chk_guard'
/usr/lib/gcc/riscv64-unknown-linux-musl/14/../../../../riscv64-unknown-linux-musl/bin/ld: /home/mjo/src/zsbl.git/build/../drivers/sd/mmc.c:62:(.text.mmc_send_cmd+0x90): undefined reference to `__stack_chk_fail'
...

One way to work around this is with -fno-stack-protector, but maybe there is a way to keep the stack protection? If this were a normal userland program, it would need to link with libc and/or libssp_nonshared depending on the libc. But obviously that won't work for ZSBL. I do know that the linux kernel has some support for a stack protector though so there must be some way to do it.

Build failure from RELRO in .vector section

Hi, if I am using the distro toolchain on the pioneer (and not cross-compiling with the bundled GCC), I get a build failure due to a relocation:

ld -r -o libzsbl.a --whole-archive common/built-in.a arch/riscv/src/built-in.a drivers/built-in.a lib/built-in.a plat/built-in.a test/built-in.a --no-whole-archive
/usr/lib/gcc/riscv64-unknown-linux-musl/14/../../../../riscv64-unknown-linux-musl/bin/ld: arch/riscv/src/vector.o: warning: relocation against `_fw_start' in read-only section `.vector'
/usr/lib/gcc/riscv64-unknown-linux-musl/14/../../../../riscv64-unknown-linux-musl/bin/ld: read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status

This can be worked around with -Wl,-znotext but there is probably a better solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.