Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2017.01.28 MicroZedとSDSoCでオシロスコープを作る
Search
muojp
January 28, 2017
Programming
0
1.4k
2017.01.28 MicroZedとSDSoCでオシロスコープを作る
SDSoCでLinuxアプリの拡張モジュールを書く話
SDSoC勉強会
muojp
January 28, 2017
Tweet
Share
More Decks by muojp
See All by muojp
16.09.25 Chisel+FIRRTL/自作HDLの試作
muojp
1
3.9k
Other Decks in Programming
See All in Programming
快速入門可觀測性
blueswen
0
340
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
たのしいparse.y
ydah
3
120
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
3
1.1k
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
710
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
For a Future-Friendly Web
brad_frost
175
9.4k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
It's Worth the Effort
3n
183
28k
Become a Pro
speakerdeck
PRO
26
5k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
MicroZedͱ SDSoCͰ ΦγϩείʔϓΛ࡞Δ ෭: SDSoCͰLinuxΞϓϦͷ ɹɹɹ֦ுϞδϡʔϧΛॻ͘ @muo_jp 2017/01/28 SDSoCษڧձ
ࣗݾհ(@muo_jp) ຊۀ: ϞόΠϧήʔϜͷձࣾͰιϑτΣΞ։ൃ FPGAझຯར༻ 2016ͷίϛέͰΦϦδφϧͷήʔϜ&Υoν ෩ήʔϜػ։ൃʹࢀՃ ͤͬͤͱҰൠྲྀ௨ͷগͳ͍νοϓͷϒϨʔΫΞτ ϘʔυΛ࡞ͬͯখنͳճ࿏ΛΜͩΓͯ͠·͢
ιϑτΣΞܥͷݪߘॻ͖ ׂͱೖ͚ͷࡶࢽʹͪΐ͍ ͪΐ͍ͱهࣄΛॻ͍͍ͯ·͢ ۙ.NET CoreͷهࣄΛ ॻ͖·ͨ͠
ࣗݾհ(@muo_jp) ࠷ۙ࡞ͬͨͷ microUSBέʔϒϧΛૠͤΔ҆ՁͳίωΫλ microUSBΛిݯͱͯ͠͏༻ͷͷ microUSBίωΫλΛ΄ͲΑ͘2.54mmϐονʹม͢Δ ط: http://akizukidenshi.com/catalog/g/gK-10972/ (130ԁ͙Β͍͢Δ) 10ԁ͙Β͍Ͱ࡞Γ͍ͨ 8pinoͱ͍͏Arduinoޓػ͔ΒͷΠϯεύΠΞ
None
None
None
࡞͍ͬͯΔͷ: Φγϩείʔϓ
Φγϩείʔϓͷཁ݅ ͍ΘΏΔϙʔλϒϧΦγϩ http://akizukidenshi.com/catalog/g/gM-09281/ Πϝʔδతʹळ݄ͰചΒΕ͍ͯΔDSO Nano v3ʹ͍ۙ 5VϞόΠϧόοςϦʔͰಈ࡞͢Δ HDMIग़ྗͷϞχλ(5Vۦಈ)Λ͚ͬͭͯ͘ɺUSB͔ΒిݯΛҾͬுͬͯ͏ MicroZedΛϝΠϯϘʔυͱ͢Δ Ұ୴ɺΞφϩάଳҬ1MHzͰ10MspsఔऔಘͰ͖Δঢ়ଶΛࢦ͢
MicroZedΛ ϝΠϯϘʔυʹ͢Δ? MicroZedΛબΜͩཧ༝ ͳΜ͔৭ʑແ͍ঢ়ଶ͔Β࡞Γ͔ͨͬͨ ϝϞϦ͕ZedboardΑΓଟ͘ɺ1GBࡌͬͯΔͷͰ׆͔͍ͨ͠ 2013ͷ8݄ʹจͯ͠10݄ೖखɺͦΕ͔Βࡉ͔ͳ࣮ݧʹͬ ͍͚ͯͨΕͲ ͦΖͦΖϑϧηοτ͍ͨ͠ͷΛ࡞ͬͯΈ͍ͨ ͍ͨ͠Β҆৺ͯ͠MPSoC࣌ͷධՁϘʔυΛങ͑Δؾ͕͢Δ
Ϟχλ ૾ਤ ADC֦ுϘʔυ ৴߸ݯ⚡ MicroZed
ਐߦ্ͷറΓ ެࣜൢചͷ֦ுΧʔυങΘͣʹࣗ࡞ͰΓΔ PLଆʹҾ͖͜Βͣɺ͔ͤͬ͘ZynqͳΜ͔ͩΒɺ LinuxଆʹޙஈͷϦονͳͷ͕ἧ͍ͬͯΔͳΒͳΔ ͦ͘ΕΒΛ͍͍ͨ
MicroZedͰΦγϩείʔϓɺ ΞʔΩςΫνϟΛߟ͑Δ
Πϝʔδ͔Βॱʹ ۷͍ͬͯ͘ ܗදࣔͱΠϯλϑΣʔε ిѹใͷιϑτΣΞతͳऔಘ Ξφϩά෦͔ΒಡΈऔͬͨిѹΛSDSoCଆϞ δϡʔϧҾ͖͢ ADC(ిѹͷಡΈग़͠)
ܗදࣔͱΠϯλϑΣʔε Sigrok+PulseView(Qtϕʔε)Λར༻͢Δ
ిѹใͷιϑτΣΞత ͳऔಘ Sigrok༻ͷυϥΠόΛॻ͍ͯϝΠϯϝϞϦ্ʹஔ͔Ε ͨ࠷৽σʔλΛಡΈऔΔ Sigrok༻υϥΠόSDSoCͰ࡞ΒΕͨڞ༗ϥΠϒϥ ϦΛհͯ͠PLͱͷ௨৴Λ͓͜ͳ͏ ͕͜͜ࠓͷຊ
Ξφϩά෦͔ΒಡΈऔͬͨిѹ ΛSDSoCଆϞδϡʔϧҾ͖͢ AXI4-Lite + AXI4-Stream ࠓճҰ୴10MspsఔಡΈऔΕΕok τϦΨʔઃఆϨϯδΓସ͑ɺ৴߸Ωϟϓνϟͷ ։࢝/ఀࢭAXI4-Liteܦ༝Ͱ͓͜ͳ͏ ADC͔ΒಡΈऔͬͨΛAXI4-StreamʹแΜͰSDSoC ଆϞδϡʔϧྲྀ͢·ͰVerilog
HDLͰߏங͢Δ
ADC(ిѹͷಡΈग़͠) ෦ADC(XADC)ͰؤுΔ? 5-6bit·͋ग़ΔͬΆ͍ ֎෦ADCΛ͏? SPIͰಡΈग़ͤΔADC AD7665ͱ͔(͕͢͞ʹ͍)ɺAD7671ͱ͔ΞϦͦ͏ AD9283(80Msps, 8bit ADC)Λ͏ ←
ࠓճ͜ΕͰ
ݱঢ়
Sigrok༻υϥΠό http://sigrok.org/ ͜ΕͷϘʔυ֦ுυϥΠόΛॻ͘ https://github.com/anatol/libsigrok/blob/master/include/ libsigrok/libsigrok.h#L994-L1062 ݱߦίʔυΑΓͪΐͬͱݹ͍ ࠷ۙsigrok.org͕ௐࢠѱ͍ͷͰ࠷৽ίʔυΛरͬͯ͘Δ ͷʹগʑّ͢Δ
Sigrokͷ৴߸Ωϟϓνϟॲཧ ϥΠϑαΠΫϧ int (*dev_open) (struct sr_dev_inst *sdi); int (*dev_close) (struct
sr_dev_inst *sdi); int (*dev_acquisition_start) (const struct sr_dev_inst *sdi, void *cb_data); int (*dev_acquisition_stop) (struct sr_dev_inst *sdi, void *cb_data);
Sigrok(PS্Ͱ݁ͯ͠ಈ࡞)༻υϥΠό͔Β PLΛୟ͘?? PS PL Ξφϩά ΠϯλϑΣʔε(ADC) Sigrok SigrokυϥΠό SDSoCͰΜͩAXI4 ΠϯλϑΣʔε(.so)
ADCΠϯλϑΣʔε (Verilog HDL)
Sigrok(PS্Ͱ݁ͯ͠ಈ࡞)༻υϥΠό͔Β PLΛୟ͘?? PS PL Ξφϩά ΠϯλϑΣʔε(ADC) Sigrok SigrokυϥΠό SDSoCͰΜͩAXI4 ΠϯλϑΣʔε(.so)
ADCΠϯλϑΣʔε (Verilog HDL)
Sigrok(PS্Ͱ݁ͯ͠ಈ࡞)༻υϥΠό͔Β PLΛୟ͘?? PS PL Ξφϩά ΠϯλϑΣʔε(ADC) Sigrok SigrokυϥΠό SDSoCͰΜͩAXI4 ΠϯλϑΣʔε(.so)
ADCΠϯλϑΣʔε (Verilog HDL) ී௨ͷLinuxΞϓϦͷϢʔβϞʔυυϥΠό͔Β SDSoCͰΜͩڞ༗ϥΠϒϥϦΛݺͼग़͍ͨ͠
։ൃϑϩʔ্ͷཁٻ Ϙʔυʹసૹͯ͠ಈ࡞֬ೝ͢ΔසΛԼ͍͛ͨ PL෦ʹґଘ͠ͳ͍ιϑτ։ൃ(ۀՄೳੑ) SigrokͷZynq༻όΠφϦੜͱ PulseViewυϥΠόྨͷࢼߦࡨޡΛΓ͚͍ͨ Ϙʔυ্Ͱಈ࡞ͤ͞Δࡍʹ͖ͪΜͱPLΛ͏ ϥΠϒϥϦΛݺͼग़͢ ιϑτଆͰ݁ͯ͠CI(Continuous Integration)ྲྀ͍ͨ͠
ʮSDSoCͰLinuxΞϓϦͷ ֦ுϞδϡʔϧΛॻ͘ʯ
TL; DR UG1027ͷ ୈ10ষʹ ॻ͍ͯ͋Γ·͢ɻ
SDSoCͷαϯϓϧ SDSoC୯ମΞϓϦέʔγϣϯͰ݁ͤͣ͞ɺՌ ΛϥΠϒϥϦͱͯ͠ར༻͢Δྫ͕2छྨ͋Δ samples/fir_lib samples/libmatrix
samples/fir_lib sdslib -lib libfir.a \ fir fir.c \ fir_reload fir_reload.c
\ fir_config fir_config.c \ -vlnv xilinx.com:ip:fir_compiler:7.2 \ -ip-map fir_compiler.fcnmap.xml \ -ip-params fir_compiler.params.xml
samples/fir_lib sdslibίϚϯυΛར༻ͯ͠੩తϥΠϒϥϦΛ࡞Δύ λʔϯ ࡞ͬͨϥΠϒϥϦSDSoCڥʹดͯ͡͏લఏ ͜ΕΛΰϦΰϦͱޙՃͯ͠ڞ༗ϥΠϒϥϦΛ࡞Ε ྑ͍...?
XilinxͷϖʔδΛ୳͠ճΔ ΞϓϦέʔγϣϯΛϥΠϒϥϦͱͯ͠ΤΫεϙʔτ (ུ)ʙͭ·Γɺಉ͡ϋʔυΣΞ γεςϜΛλʔήο τͯ͠ sdscc Ͱੜ͞ΕͨϒʔτڥΛ༻͠ͳ͕ ΒɺҙͷιϑτΣΞ։ൃڥͰ GNU πʔϧ
νΣʔϯΛ༻ͯ͠ιϑτΣΞΛ։ൃͰ͖·͢ɻ ͜Ε!!
ࢦఆ͞Εͨαϯϓϧ͕ 2016.2/3ʹଘࡏ͠ͳ͍
αϯϓϧσΟϨΫτϦʹΔͱ libmatrixͱ͍͏ͷ͕͋Δ
samples/libmatrix ߦྻܭࢉΛSDSoCܦ༝ͰPL͢ҰࣜΛ੩తϥΠϒ ϥϦɾڞ༗ϥΠϒϥϦͱͯ͠ग़ྗ͢Δαϯϓϧ libmatrix/build/static/Makefile ←.a libmatrix/build/shared/Makefile ←.so ͱ͔ͯΓ͍͢αϯϓϧ
੩తϥΠϒϥϦੜ sds++͔ΒϏϧυͨ͠*_accelܥͷΦϒδΣΫτϑΝΠϧΛؚΉ ੩తϥΠϒϥϦʹݺͼग़͠ଆ(ΠϯλϑΣʔεؔ)ΛՃ͢Δͱ ͍͏Ճ matrix.linked: mmult_accel.o madd_accel.o matrix.o ${CC} $^
-nostartfiles -o $@ ${LIBRARY}: matrix.linked cp _sds/swstubs/${LIBRARY} . arm-linux-gnueabihf-ar rcs ${LIBRARY} _sds/ swstubs/matrix.o
ڞ༗ϥΠϒϥϦੜ ֤ΦϒδΣΫτϑΝΠϧੜ࣌ʹ-fPICΛ͚ͭͯίϯύΠϧ ϥΠϒϥϦੜखॱͪ͜Βͷ΄͏͕ૉͰɺsds++͔Β -shared ΦϓγϣϯͰ.soΛ࡞͍ͬͯΔ ${LIBRARY}: mmult_accel.o madd_accel.o matrix.o
${CC} -shared $^ -o $@
͋ͱී௨ʹLinuxͷจ຺Ͱ ར༻͢Δ
Α͘ݟΔͱɺUG1027ͷୈ10ষʹ͋ͬͨ
શ෦ͪΌΜͱॻ͍ͯ·ͨ͠ (વ)ϚϧνεϨουݺͼग़͠αϙʔτ͠ͳ͍ͷͰɺ ݺͼग़͠ͷલஈͰ໘ΛݟΔඞཁ͕͋ΔɺͳͲҙॻ͖ࠐΈͰɻ
SDSoC 2016.2ͱSDx 2016.3ͱ MicroZed
SDSoC 2016.2ͱMicroZed settings64.batͰڥઃఆޙʹαϯϓϧ͍Ζ͍Ζmake PLATFORM=microzedΛࢦఆͯ͠make ͜ͱ͝ͱࣦ͘ഊ͢Δ LUTෆͱDSPෆͷ͋Θٕͤ PLATFORM=zybo௨ΔɻMicroZed(Z-7010)ͱ ZYBO(Z-7010)ɺͲ͜Ͱ͕͍ࠩͭͨͷ͔…
SDx 2016.3ͱMicroZed 2016.2Ͱશવ௨Βͳ͔ͬͨmmult_addͷαϯϓϧ ͕ɺ௨ͬͨ(ߦྻαΠζΛখͨ͘͞͠) SDxͷIDE͔ΒMicroZed༻ʹςϯϓϨʔτ͔ΒϓϩδΣ ΫτΛੜͯ͠ɺಉ༷ʹ௨Δ MicroZed͚ͷSDSoC͚BSP͕2016.2→3Ͱվળ? SDSoC GUIͷςϯϓϨʔτ͔ΒϓϩδΣΫτ࡞͢Δ ͱɺMicroZedͰͦͦarea
reduced൛͔͠ग़ͳ͍
ҎԼɺSDSoCҎ֎ͷ
࠷ऴతʹQtSigrokΛؚΊͨ rootfs͕ඞཁ PetaLinuxܦ༝ͰYoctoΛѻ͏ͷ͕దͦ͏ MicroZedͰ৽͠ΊͷPetaLinuxΛѻ͏Λݟ͔͚ͳ͔ͬ ͨͷͰɺblogʹ·ͱΊͨ http://www.muo.jp/2017/01/petalinux-microzed.html PetaLinuxͰखܰʹZynq(MicroZed)༻ΧελϜLinuxΛ ࡞Δ PetaLinux SDK
2016.2→2016.3Ͱ͔ͳΓYoctoͬΆ͕͞ ্͕͍ͬͯΔ͚ΕͲɺMicroZed2016.2Ͳ·Γɻɻɻ
Ξφϩά෦ʙ֎෦Πϯλ ϑΣʔεͷݱঢ়
None
None
None
ArduinoͰൃੜͤͨ͞ ύϧεΛADC͔ΒಡΈऔΓ
֎ງ͔ΒຒΊͯΔঢ়ଶ
Zedboardͱൺֱ͢Δͱ͔ͳ Γελʔτ͕ޙํ Δ͜ͱͷൣғ͕ͱʹ͔͍͘ MicroZedͷ֦ுϙʔτ DVI/HDMIͰͷϞχλग़ྗ
MicroZedͷ֦ுϙʔτ ඪ४࣮ϙʔτZedboardΑΓ͔ͳΓগͳ͍ 12ϐϯͷPmodͻͱͭ+LED1+λΫτεΠον1ͷΈ ཪ໘ʹ100ϐϯͷFMCεϩοτ͕2ͭੜ͍͑ͯΔ ࢀর: MicroZed_HW_UG_v1_4.pdf େҙ: ࣗͰ͖ʹిݯΛڙڅͯ͠(ϝΠϯϘʔυ͔Β ڙڅ͠ͳ͍Α)ɺ͖ʹͬͯͶ
None
None
DVI/HDMIͰͷϞχλग़ྗ దʹϑϨʔϜόοϑΝ͔Βग़ྗΛಘͯϞχλʹ ग़ͦ͏ͱ͢Δ →/dev/fb0͕ͦͦੜ͍͑ͯͳͯ͘ࠔΔ ADV7511༻VDMAϕʔεͷυϥΠόADI͕ग़ͯ͠Δ ࢀߟใ: TIͷਓͷεϥΠυ(fb_deferred_ioΛར༻͢Δ) ࢦఆִؒͰߋ৽͞ΕͨϖʔδϦετ͕ͬͯ͘Δ https://github.com/Freescale/linux-module-virtfb ←Ϋϥογϡ
FPGAͷ֎ଆ 100ϐϯx2ͷϝβχϯΧʔυࣗ࡞͢Δ ίωΫλҰࡢೖΕͯ͋Δ ΞφϩάϑϩϯτΤϯυͷཧղ͕͍͍ͭͯͳ͍ͷͰ ؤுΔ mhz100q ( mhz100q.sourceforge.net ) Marmaladeຊx2
(߲࣍)
Marmaladeຊ (Έ͔ΜϓϩδΣΫτץ) ίϛέͰച͍ٕͬͯͨज़ಉਓࢽ FPGAͰΦγϩΛ࡞Δ WindowsΞϓϦʹసૹɾදࣔ mhz100qͱಉ༷ɺAD9283Λར༻ Ξφϩά෦ͷղઆ͕͋Γ͕͍ͨ
·ͱΊ ͬͺΓϚΠφʔͳϘʔυݫ͕͋͠͞Δ UGͪΌΜͱಡ͏ ઌ͍͚ΕͲ͍ͬͯ͘