usbarmory / tamago

TamaGo - ARM/RISC-V bare metal Go
BSD 3-Clause "New" or "Revised" License
1.35k stars 52 forks source link

tamago-example-pizero compiler error - duplicated definition of symbol runtime.getRandomData #42

Closed Gustavomurta closed 1 year ago

Gustavomurta commented 1 year ago

Hi, I am very interested in testing this Raspberry Pi BareMetal in Golang. When testing with the Rasp Pi Zero example, I try to compile and I am receiving this error message. I don't know how to solve it. Can someone help me please? Thanks.

https://github.com/usbarmory/tamago-example-pizero

root@raspberrypi:/home/jgust/go/programas/tamago/tamago# make install GO_EXTLINK_ENABLED=0 CGO_ENABLED=0 GOOS=tamago GOARM=5 GOARCH=arm /usr/local/tamago-go/bin/go build -ldflags "-s -w -T 0x00010000 -E _rt0_arm_tamago -R 0x1000 -X 'main.Build=root@raspberrypi on 2023-09-08 01:26:16' -X 'main.Revision='" -o example-pi-zero #main.go 2023/09/07 22:26:56 duplicated definition of symbol runtime.getRandomData, from github.com/usbarmory/tamago/internal/rng and github.com/usbarmory/tamago/soc/bcm2835 make: *** [Makefile:55: example-pi-zero] Erro 1 root@raspberrypi:/home/jgust/go/programas/tamago/tamago#

abarisani commented 1 year ago

Thanks for your report, this is now fixed.

Gustavomurta commented 1 year ago

Thank you very much! I will do the tests

Gustavomurta commented 1 year ago

I am very happy and grateful. Thank you very much! Everything worked ok. Grazie !

root@raspberrypi:/home/jgust/go/programas/tamago/tamago# make install GO_EXTLINK_ENABLED=0 CGO_ENABLED=0 GOOS=tamago GOARM=5 GOARCH=arm /usr/local/tamago-go/bin/go build -ldflags "-s -w -T 0x00110000 -E _rt0_arm_tamago -R 0x1000 -X 'main.Build=root@raspberrypi on 2023-09-09 01:20:08' -X 'main.Revision='" -o example-pi-zero go: downloading github.com/usbarmory/tamago v0.0.0-20230908111547-14f7d889ca3b arm-none-eabi-objdump -D example-pi-zero > example-pi-zero.list arm-none-eabi-objcopy -j .text -j .rodata -j .shstrtab -j .typelink \ -j .itablink -j .gopclntab -j .go.buildinfo -j .noptrdata -j .data \ -j .bss --set-section-flags .bss=alloc,load,contents \ -j .noptrbss --set-section-flags .noptrbss=alloc,load,contents\ example-pi-zero -O binary example-pi-zero.o arm-none-eabi-gcc -D ENTRY_POINT=arm-none-eabi-readelf -e example-pi-zero | grep Entry | sed 's/.*\(0x[a-zA-Z0-9]*\).*/\1/' -c boot.S -o boot.o arm-none-eabi-objcopy boot.o -O binary stub.o Truncate pads the stub out to correctly align the binary 1081344 = 0x110000 (TEXT_START) - 0x8000 (Default kernel load address) truncate -s 1081344 stub.o cat stub.o example-pi-zero.o > example-pi-zero.bin cp example-pi-zero.bin /media/jgust/748F-C7F7/example-pi-zero.bin cp config.txt /media/jgust/748F-C7F7/config.txt

After compiling in Raspberry Pi3B:

root@raspberrypi:/home/jgust/go/programas/tamago/tamago# ls -l total 19248 -rw-r--r-- 1 root root 688 set 8 22:20 boot.o -rw-r--r-- 1 jgust jgust 92 set 25 2020 boot.S -rw-r--r-- 1 jgust jgust 279 set 25 2020 config.txt -rwxr-xr-x 1 root root 1380352 set 8 22:20 example-pi-zero -rw-r--r-- 1 root root 2534824 set 8 22:20 example-pi-zero.bin -rw-r--r-- 1 root root 14296746 set 8 22:20 example-pi-zero.list -rwxr-xr-x 1 root root 1453480 set 8 22:20 example-pi-zero.o -rw-r--r-- 1 root root 131 set 8 22:05 go.mod -rw-r--r-- 1 root root 228 set 8 22:06 go.sum -rw-r--r-- 1 jgust jgust 4964 set 8 22:08 main.go -rw-r--r-- 1 jgust jgust 2310 set 8 21:59 Makefile -rw-r--r-- 1 jgust jgust 795 set 25 2020 README.md -rw-r--r-- 1 root root 1081344 set 8 22:20 stub.o root@raspberrypi:/home/jgust/go/programas/tamago/tamago#

Connecting a Cp2102 USB/Serial module to the Raspberry Pi Zero serial port (115200 Bps): Fantastic!

Raspberry Pi Bootcode Read File: config.txt, 279 Read File: start.elf, 2978368 (bytes) Read File: fixup.dat, 7268 (bytes) MESS:00:00:01.059302:0: brfs: File read: /mfs/sd/config.txt MESS:00:00:01.063511:0: brfs: File read: 279 bytes MESS:00:00:01.111698:0: brfs: File read: /mfs/sd/config.txt MESS:00:00:01.115977:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined MESS:00:00:01.136411:0: gpioman: gpioman_get_pin_num: pin WL_LPO_CLK not defined MESS:00:00:01.142121:0: gpioman: gpioman_get_pin_num: pin BT_ON not defined MESS:00:00:01.148799:0: gpioman: gpioman_get_pin_num: pin WL_ON not defined MESS:00:00:01.177735:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined MESS:00:00:01.183560:0: *** Restart logging MESS:00:00:01.187437:0: brfs: File read: 279 bytes MESS:00:00:01.204982:0: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined MESS:00:00:01.219460:0: HDMI0: hdmi_pixel_encoding: 162000000 MESS:00:00:01.228768:0: dtb_file 'bcm2708-rpi-zero.dtb' MESS:00:00:01.232368:0: dtb_file 'bcm2708-rpi-b-plus.dtb' MESS:00:00:01.237490:0: dtb_file 'bcm2835-rpi-zero.dtb' MESS:00:00:01.242428:0: Failed to load Device Tree file '?' MESS:00:00:01.247726:0: Failed to open command line file 'cmdline.txt' MESS:00:00:01.404612:0: brfs: File read: /mfs/sd/example-pi-zero.bin MESS:00:00:01.409274:0: Loaded 'example-pi-zero.bin' to 0x8000 size 0x26ada8 MESS:00:00:01.417225:0: uart: Set PL011 baud rate to 103448.300000 Hz MESS:00:00:01.423753:0: uart: Baud rate change done... MESS:00:00:01.427186:0: uart: Baud rate change done... MESS:00:00:01.432577:0: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined 1970/01/01 00:00:03 Hello World! 1970/01/01 00:00:03 -- rng ------------------------------------------------------------- 1970/01/01 00:00:03 random bytes 79ea500d009d45d79e10 1970/01/01 00:00:03 a04a33f2da7bf168293a9f23f86ed4ff2f4a267993a01cb9508d8a7a0fe1cc03 1970/01/01 00:00:03 f95cffc9fb2a8605f7bf628ffcf311b7ea5df33ff4838b209a9f2537d11f68f8 1970/01/01 00:00:03 a2bf516a7a0d84cc0a87ca365e4bd454f58d62545e976df43ee1ead5577be9fd 1970/01/01 00:00:03 123980019b5ccf85812a1313bbacdfa6488bf9d8cda69c42b30fe63521679534 1970/01/01 00:00:03 06d7fa132a220bbeb78c755de3b6f4f65737becbd92c8cfbd406f3a42220d685 1970/01/01 00:00:03 320fc04b9862a855db4b23a3d16cb43b3f35bdfd2e4993e75d9a563f2452634d 1970/01/01 00:00:03 0dbe212caf0e5ae6e32a9812ea66f204252e774c4df9f06a704c84c715da552b 1970/01/01 00:00:03 2f605c6cd176afcca517e74fd56e0e1ee1ce0c14fe7f01bc39e4f4c5242a1106 1970/01/01 00:00:03 c05dc55e7a104ba621ba62688302da560f6bac55898cdc4a6ff3dc05cb25f31b 1970/01/01 00:00:03 7e6fe506c1cf262a73905e522476c8383a3a99d244a8b8a950688e11d8548946 1970/01/01 00:00:03 retrieved 32000 random bytes in 299.174ms 1970/01/01 00:00:03 -- timer ------------------------------------------------------------- 1970/01/01 00:00:03 waking up timer after 1s 1970/01/01 00:00:04 woke up at 655097000 (996.083ms) 1970/01/01 00:00:04 -- RAM --------------------------------------------------------------- 1970/01/01 00:00:04 allocating 400MB 1970/01/01 00:00:05 wiping allocation with 0xff 1970/01/01 00:00:15 allocating 400MB 1970/01/01 00:00:15 wiping allocation with 0xff 1970/01/01 00:00:25 -- watchdog ---------------------------------------------------------- 1970/01/01 00:00:25 Starting watchdog at 1s 1970/01/01 00:00:26 Watchdog Remaining after 600ms: 399.936ms, resetting 1970/01/01 00:00:26 Watchdog Remaining after 600ms: 399.968ms 1970/01/01 00:00:26 Watchdog stopped, waiting for 2 sec 1970/01/01 00:00:28 -- LED --------------------------------------------------------------- 1970/01/01 00:00:28 Flashing the activity LED