News for hackers. Stuff that matters.
Re:Verilog sources for Western Digital's open source RISC-V ... by dbcurtis on Saturday January 26, 2019 @10:59PM (#19010276)
> I'm sure you can setup GCC to work with this, but it would be a project.

FWIW AVR is not only Harvard, but code memory addresses point to 16-bit words, and data pointers to bytes. Yet, gcc works great (mostly). It is mainly a matter of whipping up a good linker script and directing code and data to the appropriate sections. Not particularly hard, although Harvardness does leak into your C code, mostly when taking pointers to functions or literal sections stored in flash.

*mostly — gcc long ago stopped taking optimization for code size seriously. Unfortunate for uCtlr users, as for small processors like the AVR optimization for size is pretty much also optimization for speed. Gcc has had some pretty serious code-size regressions in the past — but mostly not noticed by people not trying to shoehorn code into a tiny flash space.

Re:Verilog sources for Western Digital's open source RISC-V ... by gmueckl on Saturday January 26, 2019 @11:09PM (#19010304)
For ARM, I have seen IAR emit unoptimized code half the size of GCCs output with speed optimizations enabled (which lead to slightly smaller code than size optimization!). When optimizing for size, IAR shrank the code size by another 1/3 to 1/2. When you are really strugging to fit functionality into a tight contoller because your hw engineers won't put in a bigger contoller, this is a dealbreaker.
Re:Verilog sources for Western Digital's open source RISC-V ... by dbcurtis on Saturday January 26, 2019 @11:28PM (#19010343)
Agree completely that it is a deal breaker. But don’t be too hard on the hardware engineers, sometimes the BOM can not afford the extra 17 cents.
Re:Verilog sources for Western Digital's open source RISC-V ... by gmueckl on Sunday January 27, 2019 @01:23AM (#19010584)
I guess the tone came out wrong. I understand why we got the HW we got. In this case it wasn't even about cost. The power available to the device as a whole was so low that we were counting microamps. It was all incredibly tight:

Just switching on the wrong SoC feature would bring the entire thing outside the envelope. Even the contents of the passive LCD affected power consumption in adverse ways. Showing a checkerboard pattern could make the device fail.

Re:Verilog sources for Western Digital's open source RISC-V ... by haberman on Saturday January 26, 2019 @11:06PM (#19010298)
It's surprising to me that the RISC-V ISA specification is loose enough that a core could be considered RISC-V-compliant and yet also need a linker script to accommodate its peculiarities.
Re:Verilog sources for Western Digital's open source RISC-V ... by dbcurtis on Saturday January 26, 2019 @11:31PM (#19010349)
?? linker scripts are about the layout of the executable. The OS (if there is one) is the driver of that. ISA spec is an orthogonal concept.
Re:Verilog sources for Western Digital's open source RISC-V ... by haberman on Saturday January 26, 2019 @11:46PM (#19010376)
On x86-64, the page tables control memory access permissions (rwx). The layout and semantics of these page tables are defined by the ISA and work the same on any processor. You wouldn't need to lay out your binary differently on Intel vs. AMD, for example.

It sounds like AVR, by contrast, has some parts of the address space that are (x) only and others that are (rw) only, even though other RISC-V processors don't have this restriction. That seems odd to me.

Maybe it's not as odd if you think of memory as a device that is mapped into your address space. ROM could be mapped into an x86-64 address space and be read-only -- even if the page table said it was writable it would probably throw some kind of hardware exception if you tried to actually write it.

Re:Verilog sources for Western Digital's open source RISC-V ... by Dylan16807 on Sunday January 27, 2019 @12:19AM (#19010447)
(AVR isn't RISC-V)

Having page tables at all is completely optional on RISC-V. This is a chip with no MMU.

Re:Verilog sources for Western Digital's open source RISC-V ... by blattimwind on Sunday January 27, 2019 @07:30AM (#19011448)
> It sounds like AVR, by contrast, has some parts of the address space that are (x) only and others that are (rw) only, even though other RISC-V processors don't have this restriction. That seems odd to me.

AVRs have three separate address spaces (program, RAM/data, EEPROM), i.e. the address "0" exists three times. Additionally their registers live in RAM.

Re:Verilog sources for Western Digital's open source RISC-V ... by pjc50 on Sunday January 27, 2019 @12:39PM (#19012736)
Every architecture has a gcc linker script, it's just that most of them have a default one hiding in an "arch" directory somewhere that works for normal use.
Re:Verilog sources for Western Digital's open source RISC-V ... by ComputerGuru on Sunday January 27, 2019 @12:20AM (#19010450)
It occurs to me that the more likely explanation is that GCC devs aren’t up to date on the specs and that perhaps a unified situation is possible, just not implemented.