Advertisement
JayAurabind

frenode_embedde_log

Dec 27th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.51 KB | None | 0 0
  1. * Now talking on ##embedded
  2. * Topic for ##embedded is: Discussion regarding embedded electronics. For other electronics chat, go to ##electronics || Books: http://is.gd/L6Pz6Z || http://www.alldatasheet.com/ || If you can't talk, you need to be identified/logged in with freenode
  3. * Topic for ##embedded set by obnauticus!~obnauticu@unaffiliated/obnauticus at Fri Nov 7 00:49:13 2014
  4. <MikeHibbett> Because I would rather be hacking..
  5. <MikeHibbett> I still haven't built up my own drum synth board yet
  6. <MikeHibbett> Might do that tonight, as a reward
  7. * toxxin ([email protected]) has joined ##embedded
  8. <jayaura> Is there any channel I can ask topics related to arm architecture, and programming ?
  9. <MikeHibbett> Try here, a lot of us use arm
  10. <MikeHibbett> I'm working with Cortex M4
  11. <jayaura> I am trying to interface make my own coprocessor on rpi. I would interface it through ethernt to the fpga. How should I proceed?
  12. <jayaura> oh sorry no make intended there
  13. <jayaura> I'll just rephrase again. I want to connect a custom hardware i have on an fpga to the pi, through ethernet
  14. <jayaura> I plan to do it on the instruction level
  15. <jayaura> I would replace a co processor instruiction and redirect it to another fucntion which makes a syscall to kernel driver.
  16. <SpeedEvil> err - what?
  17. <MikeHibbett> ARM architecture is irrelevant I think. So if you are using an FPGA, would I be right in thinking you know VHDL or Verilog?
  18. <SpeedEvil> jayaura: Do you mean 'I want to connect a comprocessor over ethernet' ?
  19. <jayaura> SpeedEvil, yes
  20. <jayaura> ofcourse the hdl part is ther
  21. <jayaura> but I'm thinking how will I make it work
  22. <jayaura> so i need a kernel part to talk to it
  23. <SpeedEvil> Ethernet is so hideously ridiculously slow that if you try simply trapping on instructions and executing them you get murderous stalls.
  24. <MikeHibbett> yep
  25. <kfoltman> trapping on instructions, I don't think that's doable these days
  26. <SpeedEvil> As in - one 'instruction' may take ten million times what you expect
  27. <jayaura> SpeedEvil, so what interface would u suggest for me to connect an extra coprocessor on an fpga
  28. <SpeedEvil> Why ar eyou doing this.
  29. <MikeHibbett> I see a new programming language being created: "Treacle"
  30. <jayaura> SpeedEvil, to learn. Just that
  31. * devgiant (~devgiant@unaffiliated/devgiant) has joined ##embedded
  32. <SpeedEvil> https://en.wikipedia.org/wiki/Multiprocessing#Processor_coupling
  33. <SpeedEvil> The difference between tightly and loosely coupled is important
  34. <jayaura> thanks I'll check that
  35. <jayaura> okay
  36. <SpeedEvil> tightly coupled would be something hooked to an internal bus or an external one that can be accesses in several (hundred) cycles at most.
  37. <SpeedEvil> loosely coupled is ethernet, or parcel-post.
  38. <jayaura> I see
  39. <jayaura> What about pci? forget rpi at the first place. Lets say galileo with the mini pcie
  40. <jayaura> SpeedEvil, would that be fast enough ?
  41. <MikeHibbett> Fast enough for what?
  42. <SpeedEvil> I don't think galileou has mini-pcie
  43. <MikeHibbett> It does
  44. <GeDaMo> What does your FPGA do?
  45. <SpeedEvil> I'm probably thinking of edison
  46. <jayaura> MikeHibbett, fast enough in the sense it should work. Not interested in performace numbers
  47. <MikeHibbett> Edison may on the breakout board
  48. <MikeHibbett> jayaura: Then yes.
  49. <MikeHibbett> Get yourself a cheap generation 1 galileo board
  50. <jayaura> MikeHibbett, and does that hold just to pci on galileo ?
  51. <jayaura> MikeHibbett, what about ethernet on rpi ? Is it too slow for that/
  52. <jayaura> ?
  53. <SpeedEvil> jayaura: 'work' means nothing
  54. <MikeHibbett> ethernet is too slow if you are tightly coupling
  55. <MikeHibbett> If you are not, you would find the serial interface a better bet
  56. <MikeHibbett> easier to write vhdl code.
  57. <jayaura> MikeHibbett, seriously! serial!?
  58. <MikeHibbett> Got to go, good luck
  59. <SpeedEvil> jayaura: If you're trying to do a pure proof of concept, and don't care if it's several million times slower, then ethernet may 'work'
  60. <jayaura> MikeHibbett, thank you very much for your time!
  61. <kfoltman> jayaura: maybe SPI instead of ethernet?
  62. <SpeedEvil> Serial at 1mbps or so may be faster than ethernet
  63. <SpeedEvil> for small messages, at least
  64. <SpeedEvil> the ethernet is only 10mbps
  65. <kfoltman> or 10gbps
  66. <kfoltman> :P
  67. <jayaura> kfoltman, I believe the overhead on the frames for spi and serial is pretty small compared to ethernet. Is that the primary reason for suggesting spi ?
  68. <kfoltman> jayaura: it's simple and passes data, what else do you need? :D
  69. * MikeHibbett has quit (Quit: Leaving)
  70. <jayaura> kfoltman, nothing more.:) besides on the kernel API side, spi should be easy, isnt it ?
  71. <kfoltman> yes
  72. <kfoltman> serial is second easiest, due to timing/sampling
  73. <jayaura> Where does i2c fit it?
  74. <jayaura> in*
  75. <jayaura> kfoltman, probably slower than spi ?
  76. <SpeedEvil> I meant ethernet on the pic
  77. <kfoltman> i2c is a disease
  78. <SpeedEvil> pi
  79. * Laksen ([email protected]) has joined ##embedded
  80. <kfoltman> SpeedEvil: ethernet on a pi is connected via USB, so it's a pest
  81. * Laksen has quit (Changing host)
  82. * Laksen (~laksen@unaffiliated/laksen) has joined ##embedded
  83. <jayaura> kfoltman, oh i didnt know that
  84. <SpeedEvil> kfoltman: that too
  85. <kfoltman> don't take my word for it, but it's at least the same chip
  86. <jayaura> why would they do that?
  87. * Jackneill has quit (Ping timeout: 255 seconds)
  88. <jayaura> any advantage?
  89. <SpeedEvil> jayaura: because the Pi SoC has no ethernet
  90. <jayaura> SpeedEvil, I see, So they put a special usb chip with integrated ethernet phy on it
  91. <kfoltman> SpeedEvil: I think 10/100
  92. <kfoltman> but still, USB, vomit vomit
  93. <SpeedEvil> yeah - 10/100
  94. <jayaura> One more question, I also heard intel instruction set is less open than arm. thoughts?
  95. <SpeedEvil> That means almost nothing
  96. <jayaura> So a friend suggested me to go arm for this project. because you get lof of resources online about it
  97. * flyback has quit (Quit: Leaving)
  98. <SpeedEvil> In that - it's an english sentance - but it doesn't have any technical meaning
  99. <SpeedEvil> REferences for both sets are widely available
  100. <jayaura> SpeedEvil, hmmm. okay. Do you see any special advantage in sticking to any particular architecure as far as this coprocessor project of mine is concerned?
  101. <kfoltman> jayaura: my advice would be to use arm cortex m ;)
  102. <SpeedEvil> It depends what you mean by 'coprocessor'
  103. <kfoltman> jayaura: this way it might even get actually useful
  104. <SpeedEvil> And if you simply want to do a proof of concept - or something useful
  105. <SpeedEvil> And if your 'instruction' needs 1 byte or 1G of data, and executes in 1ns or 1 year
  106. <kfoltman> jayaura: I mean, arm cortex m is weak-ass enough to make your coprocessor useful,
  107. <SpeedEvil> In principle - a deice with an external memory bus of some form may be preferred
  108. <kfoltman> so you might (as I planned) do the general OS stuff on the arm, but leave high-performance parts for the FPGA
  109. <kfoltman> SpeedEvil: uh, FSMC
  110. <SpeedEvil> yeah - that sort of thing
  111. <jayaura> FSMC new term. gotta google it
  112. <SpeedEvil> It's a memory interface on some of the ARM cortex parts
  113. <jayaura> So i was thinking of writing a kernel driver which will actually do the talking to fpga. but the userspac which requetst that co processsor is again another consideration
  114. <jayaura> for that, I am planning to replace a coprocessor instruction, and
  115. <SpeedEvil> 'replace a coprocessor instruction' doesn't mean anything
  116. <jayaura> redirect it to a routine which will make some syscalls to that kernel driver
  117. <SpeedEvil> Especially nothing helpful
  118. <jayaura> SpeedEvil, in the assembly level;
  119. <SpeedEvil> why.
  120. <jayaura> SpeedEvil, lets say I have an object code
  121. <SpeedEvil> Rather than simply a function call.
  122. <jayaura> hmm okay
  123. <jayaura> but let me please tell you wat I was thinking to do
  124. <jayaura> So in this object code, there is a coprocessir instruciton I explicitly inserted. But the arm sys doesnt have that implemented.
  125. <jayaura> I want to make it
  126. <SpeedEvil> What happens on unrecognised instructions varies with processor.
  127. <jayaura> so, I though of redirecting that instriuction to some other routuine
  128. <SpeedEvil> It may be it's silently ignored.
  129. <jayaura> SpeedEvil, but wait, I ahvent yet executed that
  130. <SpeedEvil> It may be that to do what you want you need to run a completely software emulation of the processor
  131. <jayaura> SpeedEvil, I do the redirection before execution
  132. <SpeedEvil> you mean rewrite the object code before execution?
  133. <jayaura> so that finally when the code is executed, it only sees syscall it already kniw
  134. <jayaura> SpeedEvil, yes
  135. <jayaura> SpeedEvil, rewrite the object code
  136. <jayaura> SpeedEvil, I know, bad idead
  137. <jayaura> SpeedEvil, but what else can be a portable way?
  138. <jayaura> SpeedEvil, if I try to write the ISR for undefined instruciton mode, I cant make it work on someting other than arm
  139. <jayaura> over. your thoughts please
  140. <SpeedEvil> Undefined instruction interrupts happen on other processors
  141. <SpeedEvil> It's just not all of them
  142. <kfoltman> yes, they just need different handlers
  143. <kfoltman> I guess you could even make some sort of abstraction for that
  144. <jayaura> kfoltman, abstraciton in the sense?
  145. <kfoltman> a common interface to hook instructions on different platforms
  146. <jayaura> kfoltman, I wonder if there exists such a thing
  147. <kfoltman> MikeHibbett might know, I don't
  148. <jayaura> kfoltman, what if i user linux? can I write the interrupt vector and register it thourgh the standard api and expect it to add it to system's interriuptr vector table?
  149. <kfoltman> you might write a kernel module
  150. <kfoltman> no idea
  151. <jayaura> kfoltman, i think it would be more easily done with a baremetal toolchain. right?
  152. <jayaura> I mean without linux
  153. <kfoltman> that's why I suggested a more bare metal-friendly platform, like some MCU
  154. <kfoltman> cortex m is what I have experience with, but there are also MIPS platforms and some others
  155. <jayaura> kfoltman, I get it now! :)
  156. <SpeedEvil> In general - 'tightly coupled' processors like this that simply atomically replace operations with external hardware worked well on the 386
  157. <jayaura> can the tiva c series, cortex m4 run uclinux?
  158. <SpeedEvil> Today they're basically pointless as they cause extreme pipeline stalls, unless they're damn near on-die.
  159. <SpeedEvil> Call the external hardware - go do something else and get an interrupt when ready
  160. <kfoltman> jayaura: I'm not aware of any linux on cortex m
  161. <kfoltman> yes, why bother with new instructions if you can simply make a syscall
  162. <SpeedEvil> Even if you're planning on implementing it later in actual hardware on the chip - doing this doesn't make much sense
  163. <kfoltman> you can't really extend a pipelined imlementation of an instruction set architecture
  164. <kfoltman> pipelined/superscalar/out-of-order
  165. <jayaura> hmmm making sense
  166. <kfoltman> what you might want to do is *implementing* an ISA on FPGA, but that's lot more work
  167. <jayaura> kfoltman, I had experience implemntion openrisc on fpga. Though no custom stuff, just a basic port. Through this project, I just want to get some kicks out of a kernel module talking to my own hardware :P
  168. <jayaura> SpeedEvil, regarding the "atomically replacing operations" you mentioend above, did you mean the processor caught an instruction and sent it to be procesesed to an external hardware, provided it is present ?
  169. <SpeedEvil> yes
  170. <SpeedEvil> For the 386, that was how it worked
  171. <jayaura> SpeedEvil, so in olden days they didnyt have the SoCs, thats why such a design probably
  172. <SpeedEvil> An instruction which was not present happened - it triggered a fault. The 387 caught this fault, and interpreted the instruction and handed back to the 386
  173. <SpeedEvil> this happened in ~1 clock cycle or so
  174. <SpeedEvil> It did not significantly slow things down.
  175. <jayaura> SpeedEvil, so these days I cant do it on hardware becauye i simply wont get such a hardware >
  176. <jayaura> ?
  177. <SpeedEvil> There were no pipelines at all on the 386, or no internal caches, or nothing that makes it hard
  178. <jayaura> SpeedEvil, the 387 and all? Do they exist now?
  179. <SpeedEvil> Today - at the very best - if you're actually connected to a high-speed bus - you'll have a ~50 cycle stall.
  180. <SpeedEvil> They can be purchased.
  181. <SpeedEvil> But they're 1980s processors
  182. <SpeedEvil> If you're connected to a bus like PCIe - the stall is more like 200 cycles IIRC
  183. <SpeedEvil> Ethernet may be millions of cycles.
  184. <jayaura> :-O
  185. <jayaura> SpeedEvil, I'm glad I can find people you here :)
  186. <jayaura> people like* you :P
  187. <jayaura> Thanks for sharing your insights SpeedEvil kfoltman :)
  188. * k1k3 has quit (Quit: 0x00)
  189. * devgiant_ (~devgiant@unaffiliated/devgiant) has joined ##embedded
  190. * devgiant has quit (Ping timeout: 244 seconds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement