riscv64-unknown-elf-gcc uses newlib, which relies on libgloss, which in turn uses BSP (board support package) to implement the syscalls.
You would need to create a BSP for each board/environment.
From your findings, it seems the current BSP targets linux (not my 1st choice for a bare-metal environment).
Can we define a common environment and add a BSP for real bare-metal systems?
Richard
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/791A14B7-8F0C-484E-A4F8-64E5F174159A%40livius.net.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/791A14B7-8F0C-484E-A4F8-64E5F174159A%40livius.net.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/155D7132-DF8C-4112-8BAF-360728DDB6A2%40roalogic.com.
That was my understanding as well …
From: Tommy Murphy <tommy_...@hotmail.com>
Date: Friday 25 August 2017 at 15:06
To: RISC-V SW Dev <sw-...@groups.riscv.org>
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/ce98d19a-5537-40e5-bac4-b59d4d4cb077%40groups.riscv.org.
On 25 Aug 2017, at 15:23, Richard Herveille <richard....@roalogic.com> wrote:
riscv64-unknown-elf-gcc uses newlib, which relies on libgloss, which in turn uses BSP (board support package) to implement the syscalls.
You would need to create a BSP for each board/environment.
From your findings, it seems the current BSP targets linux (not my 1st choice for a bare-metal environment).
why do you say libgloss uses BSP?
[rih] Because that’s how libgloss works …
libgloss is a small library in the newlib package, architecture specific. for risc-v, the current implementation issues `scall` traps to the kernel:
https://github.com/riscv/riscv-newlib/tree/riscv-newlib-2.5.0/libgloss/riscv
[rih] Yes, and it should be BSP that does the actual syscalls.
Can we define a common environment and add a BSP for real bare-metal systems?
there is no need for this. or at least not for the toolchain usage.
a bare-metal toolchain should simply not force the inclusion of libgloss, and the application can/should redefine all underscore specific functions (like `_write()`) to its needs.
because the current toolchain is intended for linux tests, it forces libgloss to be always linked to the application.
as such, if you build a bare-metal application and try to issue a `puts()`, you end up calling `_write()`, which calls SYS_write via a `scall`; in my tests, this resulted in a hanged core.
[rih] If written well, then you can overrule the default implementation. By default it calls _write(). But if you define write() it should call that function and not the one in the library.
Richard
That’s exactly my understanding as well.
Maybe someone from the GCC developers should step in here.
Maybe the solution is as easy as, by default, not linking libgloss?!
From: Tommy Murphy <tommy_...@hotmail.com>
Date: Friday 25 August 2017 at 17:06
To: RISC-V SW Dev <sw-...@groups.riscv.org>
Cc: "tommy_...@hotmail.com" <tommy_...@hotmail.com>, Richard Herveille <richard....@roalogic.com>
Subject: Re: [sw-dev] GCC toolchain
OK - but it still seems to me that the intention is that the riscv[xx]-unknown-elf-gcc toolchain is a bare metal toolchain (+ newlib) but a mistake (?) in building it means that libgloss gets pulled in.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/3c754b0c-369a-424b-a1c1-5d0b60bbd226%40groups.riscv.org.
In the first message in the thread, Liviu mentions that
"riscv64-unknown-elf-gcc version is intended to generate applications
that run in linux environments, and not in bare metal environments"
because it mandates the inclusion of libgloss. My questions are:
* Is the handling of a few _functions() the only difference between a
bare metal and an os-api toolchain ? I searched for the differences,
and getting only high level difference which I understand, but I cant
seem to find them in terms of their implementation.
As per my understanding, if the riscv[xx]-unknown-elf-gcc is linked
for linux env, and it is mandating libgloss, then the only difference
between riscv[xx]-linux-gnu-gcc and riscv[xx]-unknown-elf-gcc is just
renaming ?
On 25 Aug 2017, at 18:06, Tommy Murphy <tommy_...@hotmail.com> wrote:
OK - but it still seems to me that the intention is that the riscv[xx]-unknown-elf-gcc toolchain is a bare metal toolchain (+ newlib) but a mistake (?) in building it means that libgloss gets pulled in.
the reason I started this thread was that it was confirmed that it was **not** a mistake, but an intended behaviour, which makes me think if bare-metal configurations, as we understand them, were even considered... :-(
[rih]
Well that just @*$&#^!$ then … So that means so far me and my customers have been lucky??
You can’t call a toolchain bare-metal (=without relying on an underlying OS) and then state it requires Linux. That’s just plain wrong.
This can’t be right. It might well be that test environments rely on newlib->libglogss->linux syscalls, but then those environments should explicitly link libgloss.
So far we had no issues using riscv64-unknown-elf-gcc for bare-metal environments, so it can be used. We’ve used puts() but added an ‘undef puts’ before defining our own and that seemed to work. Which already hints at that puts() was predefined.
I still don’t believe we need another toolchain; riscv64-unknown-elf-gcc is perfectly fine. It just needs to be built WITHOUT relying on libgloss.
Richard
Yes - although the vendor field can also be omitted in which case the OS is the second, not third, field.E.g.:Also this seems to back up my view that riscv[xx]-unknown-elf-gcc is for embedded (bare metal?) not linux and riscv[xx]-linux-gnu-gcc is for Linux:
riscv64-unknown-elf-gcc uses newlib, which relies on libgloss, which in turn uses BSP (board support package) to implement the syscalls.
You would need to create a BSP for each board/environment.
From your findings, it seems the current BSP targets linux (not my 1st choice for a bare-metal environment).
Can we define a common environment and add a BSP for real bare-metal systems?
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/C9E21318-A1FF-4582-B866-03904658414D%40livius.net.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/F505D96D-400E-4CA4-B265-6A733B88B136%40livius.net.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/436AB35A-DB1E-4F09-AF1A-E8D0FC0B4A49%40livius.net.
I don’t think anyone is arguing against what you’re saying here.
We do provide a custom _start() and _write(), etc.
I do agree with Liviu that the toolchain should probably not include libgloss. Or if it does, make weak versions of the 18 or so calls it implements.
What we don’t agree on is that riscv[xx]-unkown-elf-gcc is not suitable for bare-metal projects. We use it all the time and it does the job just fine.
If the toolchain builds without libgloss, then it’s what we all want, right?
Richard
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/E44CEF13-D9C2-4DB8-A0EA-F0EF113FC448%40roalogic.com.
Surely riscv[xx]-unknown-elf-gcc IS a bare metal toolchain if we (a) provide our own specific startup, linker script, write() etc and (b) ignore any libgloss issues for now (even if there may be an argument to change or fix(?) these)?
Certainly lots of people are using it in practice as such right now.
It can't simply be luck that it works?
Some of the discussion here seems to me like esoteric hair splitting that skirts/avoids the issue of simply declaring clearly whether or not it is a bare metal toolchain or at least suitable for use as such.
I think it is - not least of all because I'm using it successfully as such (admittedly with our own HAL providing startup code, ld scripts etc).
Does anybody (still?) think that it's not and, if so, why?
Regards
Tommy