Kasli-SoC: Get MAC address from EEPROM #90

Merged
sb10q merged 5 commits from mwojcik/zynq-rs:mac_from_eeprom into master 11 months ago
Owner

Added pulling data from eeprom using read_eui48 function to libconfig::net_settings. However due to size constraints in SZL, i2c code is just too much and it won't fit in OCM - thus a feature is added that keeps the hardcoded MAC, without pulling the i2c lib in.

Closes #89

Tested with modified experiments (should I include them too in the PR?).

Also get_adress got fixed into get_address (meaning it's a breaking change, artiq-zynq will need to be fixed with the next zynq-rs update).

With MAC taken from EEPROM:

❯ arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.51             ether   e8:eb:1b:45:f9:ad   C                     br0

When compiled with no_i2c feature:

❯ arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.51             ether   02:00:00:00:00:56   C                     br0
Added pulling data from eeprom using ``read_eui48`` function to ``libconfig::net_settings``. However due to size constraints in SZL, i2c code is just too much and it won't fit in OCM - thus a feature is added that keeps the hardcoded MAC, without pulling the i2c lib in. Closes #89 Tested with modified ``experiments`` (should I include them too in the PR?). Also ``get_adress`` got fixed into ``get_address`` (meaning it's a breaking change, artiq-zynq will need to be fixed with the next zynq-rs update). With MAC taken from EEPROM: ``` ❯ arp Address HWtype HWaddress Flags Mask Iface 192.168.1.51 ether e8:eb:1b:45:f9:ad C br0 ``` When compiled with ``no_i2c`` feature: ``` ❯ arp Address HWtype HWaddress Flags Mask Iface 192.168.1.51 ether 02:00:00:00:00:56 C br0 ```
mwojcik added 4 commits 11 months ago
Owner

However due to size constraints in SZL, i2c code is just too much and it won't fit in OCM - thus a feature is added that keeps the hardcoded MAC, without pulling the i2c lib in.

That doesn't sound very good. We commonly use netboot and changing the MAC address in the middle while keeping the same IP could cause some confusion.
Did you try reducing the stack size or changing compiler options?

> However due to size constraints in SZL, i2c code is just too much and it won't fit in OCM - thus a feature is added that keeps the hardcoded MAC, without pulling the i2c lib in. That doesn't sound very good. We commonly use netboot and changing the MAC address in the middle while keeping the same IP could cause some confusion. Did you try reducing the stack size or changing compiler options?
Poster
Owner

Stack goes into OCM3, while rodata goes into OCM (so changing stack size won't help).

Changing opt-level to 's' instead of 'z' does let it all fit, even with debug = true. Would that be a better solution?

Stack goes into OCM3, while rodata goes into OCM (so changing stack size won't help). Changing opt-level to 's' instead of 'z' does let it all fit, even with ``debug = true``. Would that be a better solution?
Owner

Yes.

Yes.
Owner

And if there are still problems I guess we can put more things in OCM3 by defining a new section and pushing certain data there.

And if there are still problems I guess we can put more things in OCM3 by defining a new section and pushing certain data there.
Owner

Or if the toolchain has problems with that, remap OCM3 in the assembly startup code so it becomes only one chunk of memory when Rust starts executing. The Zynq technical reference manual explains how to do that.

Or if the toolchain has problems with that, remap OCM3 in the assembly startup code so it becomes only one chunk of memory when Rust starts executing. The Zynq technical reference manual explains how to do that.
Poster
Owner

It does feel iffy - in theory 'z' opt-level should yield smaller binaries than 's', but in this case it doesn't. No need to change the stack besides that.

It does feel iffy - in theory 'z' opt-level _should_ yield smaller binaries than 's', but in this case it doesn't. No need to change the stack besides that.
mwojcik added 1 commit 11 months ago
Poster
Owner

Tested with SZL and experiments - same output with arp, pingable.

Tested with SZL and experiments - same output with ``arp``, pingable.
sb10q merged commit 43e0440911 into master 11 months ago
The pull request has been merged as 43e0440911.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/zynq-rs#90
Loading…
There is no content yet.