<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4725034836547244528</id><updated>2026-03-31T09:24:50.229-04:00</updated><title type='text'>Utopia</title><subtitle type='html'>天戴其苍，地履其黄。纵有千古，横有八荒。前途似海，来日方长。横眉冷对千倭指，俯首甘为中华牛！</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>146</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-2585201808484852942</id><published>2024-07-14T18:39:00.010-04:00</published><updated>2024-09-15T18:19:41.336-04:00</updated><title type='text'>Learning SDL Part II</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;In &lt;a href=&quot;http://dencode.blogspot.com/2024/07/learning-sdl-part-i.html&quot;&gt;Learning SDL Part I&lt;/a&gt; I talked about the 2DLight example from &lt;span&gt; &lt;a href=&quot;https://glusoft.com/sdl2-tutorials/&quot;&gt;https://glusoft.com/sdl2-tutorials&lt;/a&gt;. It might be a bit too advanced for beginner. The examples have external dependencies, and might not easy to be understood without basic concept of SDL. Code might have not been maintained after years. And may due to build tools update or package update, code cannot be built out-of-box. So I decide to start from simple one: &lt;a href=&quot;https://lazyfoo.net/tutorials/SDL&quot;&gt;https://lazyfoo.net/tutorials/SDL&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;The first example is &quot;01_hello_SDL&quot;. Since it is a simple one, I&#39;m going to try to build it with NMake. A simple Makefile for x64 would be like this:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Compiler&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;CC&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=cl&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Include directory for SDL headers&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SDL_INCLUDE&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=C:\path\to\SDL\include&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;\SDL2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Library directory for SDL library files&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SDL_LIB&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=C:\path\to\SDL\lib\x64&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Compiler flags, appending &lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;/Zi &lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;if want to debug&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;CFLAGS&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=/I&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SDL_INCLUDE&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; /Dmain=SDL_main&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Linker flags&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;LFLAGS&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=/link /LIBPATH:&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SDL_LIB&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; SDL2.lib SDL2main.lib&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;SDL2_image.lib Shell32.lib &lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;/SUBSYSTEM:CONSOLE&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Target executable name&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;TARGET&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=01_hello_SDL.exe&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Source files&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SOURCES&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;=01_hello_SDL.cpp&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Rule to make the target&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;TARGET&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SOURCES&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;CC&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;CFLAGS&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; /Fe:&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;TARGET&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;SOURCES&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;LFLAGS&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Clean target&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;clean&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; del &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;TARGET&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; *.obj&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;&lt;b&gt;Note&lt;/b&gt;: 1) &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;have to specify &lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;/SUBSYSTEM:CONSOLE&lt;/span&gt;, otherwise may get entry point not defined error as Win32 app will look for WinMain as entry point.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;2)&amp;nbsp; Have to link to &lt;span style=&quot;color: #38761d;&quot;&gt;SDL2main.lib&lt;/span&gt; and&lt;span style=&quot;color: #6aa84f;&quot;&gt; Shell32.lib&lt;/span&gt;. &lt;span style=&quot;color: #6aa84f;&quot;&gt;SDL2main.lib&lt;/span&gt; provides SDL entry function. The Shell32.lib is needed, otherwise, will get error &#39;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: #3c3c3c; color: #d0d0d0; display: inline; float: none; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function main_getcmdline&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;3) &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;For some projects need more image format support such as png, would need link to more lib, such as 06_extension_libraries_and_loading_other_image_formats, would need &lt;span style=&quot;color: #6aa84f;&quot;&gt;libpng16-16.dll&lt;/span&gt; and &lt;span style=&quot;color: #6aa84f;&quot;&gt;zlib1.dll&lt;/span&gt; which is a dependency of the png dll. If this zlib1 is missing, will only see error complaining &quot;&lt;span style=&quot;color: red;&quot;&gt;Failed loading libpng16-16.dll&lt;/span&gt;&quot; which might be misleading.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;4) For projects which needs font, would need link to&lt;span style=&quot;color: #2b00fe;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;SDL2_ttf.lib&lt;/span&gt;, and needs &lt;span style=&quot;color: #38761d;&quot;&gt;libfreetype-6.dll&lt;/span&gt; at runtime&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;5) For projects which needs audio, would need link to &lt;span style=&quot;color: #38761d;&quot;&gt;SDL2_mixer.lib&lt;/span&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;Run this to setup x64 env: &quot;&lt;span style=&quot;color: #2b00fe;&quot;&gt;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat&lt;/span&gt;&quot;, then run &#39;NMake&#39; to build. Can copy the x64 SDL dll to C:\Windows\System32 folder, then won&#39;t need to copy them to working folder every time.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;6) For projects using OpenGL, OpenGL very likely is already installed on the system. May check whether opengl.dll and glu.dll under \windows\system32. To link the lib, add these two libs: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;opengl32.lib glu32.lib&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span&gt;7) For OpenGL Extension Wrangler library, can be downloaded from &lt;a href=&quot;https://glew.sourceforge.net/&quot;&gt;https://glew.sourceforge.net/&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/2585201808484852942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/07/learning-sdl-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/2585201808484852942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/2585201808484852942'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/07/learning-sdl-part-ii.html' title='Learning SDL Part II'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-4236112225680451003</id><published>2024-07-14T14:21:00.010-04:00</published><updated>2024-08-31T21:26:29.023-04:00</updated><title type='text'>Learning SDL Part I</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;While trying to add more feature to the Tanks game, I realized that I need dive deeper into SDL programming. For this reason, I went to &lt;a href=&quot;https://glusoft.com/sdl2-tutorials/&quot;&gt;https://glusoft.com/sdl2-tutorials/&lt;/a&gt;
 and downloaded project files. As I didn&#39;t have the Visual Studio 
installed, but only the build tools, so need some tweak to build the 
examples. The downloaded package comes with solution (.sln) and project 
(.vcxproj) files. So the project can be built with command like: &lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;msbuild 2DLight.sln /p:Configuration=Release /p:Platform=&quot;x86&quot;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Also need to update the vcxproj file with v141=&amp;gt;v143, set &lt;span style=&quot;color: #2b00fe;&quot;&gt;WindowsTargetPlatformVersion &lt;/span&gt;to 10.0.22621.0 which matches my environment, and set &lt;span style=&quot;color: #2b00fe;&quot;&gt;AdditionalIncludeDirectories &lt;/span&gt;and &lt;span style=&quot;color: #2b00fe;&quot;&gt;AdditionalLibraryDirectories &lt;/span&gt;to
 have my SDL2 header file and lib paths, and need to make sure the 
setting is in &#39;x64&#39; session if using x64 as platform in above command 
line. And for the first 2DLight example, would need download &lt;a href=&quot;https://github.com/trylock/visibility&quot;&gt;https://github.com/trylock/visibility&lt;/a&gt; and &lt;a href=&quot;http://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/&quot;&gt;SDL2_gfx&lt;/a&gt; as well. Note SDL_gfx is not from libsdl.org as other SDL lib. And note, there is &lt;span&gt;&lt;a href=&quot;http://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-1.0.4.tar.gz&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; box-sizing: border-box; color: #cc6b0a; font-family: Lato, sans-serif; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-style: normal; font-variant-alternates: inherit; font-variant-caps: normal; font-variant-east-asian: inherit; font-variant-ligatures: normal; font-variant-numeric: inherit; font-variant-position: inherit; font-variation-settings: inherit; font-weight: 400; letter-spacing: normal; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; transition: 0.5s; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;SDL2_gfx-1.0.4.tar.gz&lt;/a&gt;&lt;span face=&quot;Lato, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #666666; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(&lt;/span&gt;&lt;a href=&quot;http://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-1.0.4.zip&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; box-sizing: border-box; color: #cc6b0a; font-family: Lato, sans-serif; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-style: normal; font-variant-alternates: inherit; font-variant-caps: normal; font-variant-east-asian: inherit; font-variant-ligatures: normal; font-variant-numeric: inherit; font-variant-position: inherit; font-variation-settings: inherit; font-weight: 400; letter-spacing: normal; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; transition: 0.5s; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;.zip&lt;/a&gt;&lt;span face=&quot;Lato, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #666666; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span face=&quot;Lato, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #666666; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt; &lt;/span&gt;and &lt;span&gt;&lt;a href=&quot;http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.27.tar.gz&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; box-sizing: border-box; color: #cc6b0a; font-family: Lato, sans-serif; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-style: normal; font-variant-alternates: inherit; font-variant-caps: normal; font-variant-east-asian: inherit; font-variant-ligatures: normal; font-variant-numeric: inherit; font-variant-position: inherit; font-variation-settings: inherit; font-weight: 400; letter-spacing: normal; line-height: inherit; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; transition: 0.5s; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;SDL_gfx-2.0.27.tar.gz&lt;/a&gt;, &lt;/span&gt;though the 2.0.27 is a newer release (&lt;span face=&quot;Lato, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #666666; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Ver 1.0.4 – 11 Feb 2018&lt;/span&gt; vs &lt;span face=&quot;Lato, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #666666; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Ver 2.0.27 – Sun Dec 10 2023&lt;/span&gt;),
 the later is not compatible with SDL2, and though it comes with a SDL2 
patch (also needs some tweak such as needs to link with &lt;span style=&quot;color: #2b00fe;&quot;&gt;SDL2.lib&lt;/span&gt; instead of &lt;span style=&quot;color: #2b00fe;&quot;&gt;SDL.lib&lt;/span&gt;, rename the project file as SDL2_gfx.vcxproj), the resulted lib may not work with the example code from sdl2-tutorials.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Need to make similar update for &lt;span style=&quot;color: #38761d;&quot;&gt;SDL2_gfx.vcxproj&lt;/span&gt;. And it does not have x86, but Win32, so build command is:&lt;br /&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;msbuild SDL2_gfx.sln /p:Configuration=Release /p:Platform=&quot;Win32&quot;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;May see this error: &lt;span style=&quot;color: red;&quot;&gt;SDL2_gfx-1.0.4\SDL2_gfxPrimitives_font.h(1559,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss&lt;/span&gt; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Just remove these characters (all are inline comment) should be OK.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;For error&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;SDL2_gfx-1.0.4\SDL2_gfxPrimitives.c(1771,2): error C2169: &#39;lrint&#39;: intrinsic function, cannot be defined&lt;/span&gt;, refer to &lt;a href=&quot;https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx&quot;&gt;https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx&lt;/a&gt;. Just comment out the define/implementation as this is already defined as intrinsic function.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;There
 would be a bunch error for building test if those vcxproj files have 
not been updated, and can be ignored for now. If all test project files 
got updated, 3 of the 4 tests should work out-of-box, but for 
TestImageFilter, would not see any thing displayed or printed to 
terminal. By checking the code, this Image filter test is using &#39;printf&#39;
 to log information, and the test has no graphics display. The &#39;printf&#39; 
won&#39;t spite out anything either, probably due to SDL hijacked the 
console I/O. The C code also includes &#39;windows.h&#39; when &#39;WIN32&#39; is 
defined. And in fact, w/ or w/o this header file makes no difference. 
The way to get some print out is replacing &#39;printf&#39; in the code with 
&#39;SDL_Log&#39; call. With SDL_Log, I got 23 of 27 passed OK. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Now, 
back to the 2DLight example, all build are OK, but will get runtime 
error as &quot;The application was unable to start correctly. 0xc00007b&quot;. 
Turns out this is due to mixed using x64 build tools to build x86 dll 
and executable. And the behavior is very weird. So, just avoid doing 
that.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Now with x86 build environment, build SDL2_gfx as Win32 
target, and use other x86 SDL2 lib/dll, also make sure the image/PNG 
files are copied to the run folder, no more 0xc00007b, however, seeing 
an assert for vector subscript out of range. Per Copilot: &lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: #202020; color: #cccccc; font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, sans-serif; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 8px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a data-href=&quot;command:_github.copilot.openSymbolFromReferences?%5B%7B%22%24mid%22%3A1%2C%22path%22%3A%22%2Fc%3A%2FProgram%20Files%20(x86)%2FMicrosoft%20Visual%20Studio%2F2022%2FBuildTools%2FVC%2FTools%2FMSVC%2F14.40.33807%2Finclude%2Fxkeycheck.h%22%2C%22scheme%22%3A%22file%22%7D%2C%7B%22line%22%3A508%2C%22character%22%3A8%7D%5D&quot; draggable=&quot;false&quot; href=&quot;vscode-file://vscode-app/c:/Users/squ/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html&quot; style=&quot;color: var(--vscode-textLink-foreground); text-decoration: var(--text-link-decoration);&quot; title=&quot;../../Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/include/xkeycheck.h&quot;&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textLink-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;vx.reserve(result.size())&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;call in the code snippet reserves memory for&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a data-href=&quot;command:_github.copilot.openSymbolFromReferences?%5B%7B%22%24mid%22%3A1%2C%22path%22%3A%22%2Fc%3A%2FProgram%20Files%20(x86)%2FMicrosoft%20Visual%20Studio%2F2022%2FBuildTools%2FVC%2FTools%2FMSVC%2F14.40.33807%2Finclude%2Fxkeycheck.h%22%2C%22scheme%22%3A%22file%22%7D%2C%7B%22line%22%3A508%2C%22character%22%3A8%7D%5D&quot; draggable=&quot;false&quot; href=&quot;vscode-file://vscode-app/c:/Users/squ/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html&quot; style=&quot;color: var(--vscode-textLink-foreground); text-decoration: var(--text-link-decoration);&quot; title=&quot;../../Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/include/xkeycheck.h&quot;&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textLink-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;result.size()&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;elements in the vector&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a data-href=&quot;command:_github.copilot.openSymbolFromReferences?%5B%7B%22%24mid%22%3A1%2C%22path%22%3A%22%2Fc%3A%2FProgram%20Files%20(x86)%2FMicrosoft%20Visual%20Studio%2F2022%2FBuildTools%2FVC%2FTools%2FMSVC%2F14.40.33807%2Finclude%2Fxkeycheck.h%22%2C%22scheme%22%3A%22file%22%7D%2C%7B%22line%22%3A508%2C%22character%22%3A8%7D%5D&quot; draggable=&quot;false&quot; href=&quot;vscode-file://vscode-app/c:/Users/squ/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html&quot; style=&quot;color: var(--vscode-textLink-foreground); text-decoration: var(--text-link-decoration);&quot; title=&quot;../../Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/include/xkeycheck.h&quot;&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textLink-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;vx&lt;/code&gt;&lt;/a&gt;. However, it does not change the size of the vector. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a data-href=&quot;command:_github.copilot.openSymbolFromReferences?%5B%7B%22%24mid%22%3A1%2C%22path%22%3A%22%2Fc%3A%2FProgram%20Files%20(x86)%2FMicrosoft%20Visual%20Studio%2F2022%2FBuildTools%2FVC%2FTools%2FMSVC%2F14.40.33807%2Finclude%2Fxkeycheck.h%22%2C%22scheme%22%3A%22file%22%7D%2C%7B%22line%22%3A508%2C%22character%22%3A8%7D%5D&quot; draggable=&quot;false&quot; href=&quot;vscode-file://vscode-app/c:/Users/squ/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html&quot; style=&quot;color: var(--vscode-textLink-foreground); text-decoration: var(--text-link-decoration);&quot; title=&quot;../../Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/include/xkeycheck.h&quot;&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textLink-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;reserve()&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function is used to allocate memory in advance to prevent frequent reallocations when adding elements to the vector.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: #202020; color: #cccccc; font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, sans-serif; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 8px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;To actually change the size of the vector to match the reserved capacity, you can use the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textPreformat-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;resize()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function instead of&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a data-href=&quot;command:_github.copilot.openSymbolFromReferences?%5B%7B%22%24mid%22%3A1%2C%22path%22%3A%22%2Fc%3A%2FProgram%20Files%20(x86)%2FMicrosoft%20Visual%20Studio%2F2022%2FBuildTools%2FVC%2FTools%2FMSVC%2F14.40.33807%2Finclude%2Fxkeycheck.h%22%2C%22scheme%22%3A%22file%22%7D%2C%7B%22line%22%3A508%2C%22character%22%3A8%7D%5D&quot; draggable=&quot;false&quot; href=&quot;vscode-file://vscode-app/c:/Users/squ/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html&quot; style=&quot;color: var(--vscode-textLink-foreground); text-decoration: var(--text-link-decoration);&quot; title=&quot;../../Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/include/xkeycheck.h&quot;&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textLink-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;reserve()&lt;/code&gt;&lt;/a&gt;. The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: var(--vscode-textPreformat-background); border-radius: 4px; color: var(--vscode-textPreformat-foreground); font-family: var(--monaco-monospace-font); padding: 1px 3px;&quot;&gt;resize()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;function not only reserves memory but also sets the size of the vector to the specified value.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;After
 I replaced the two reserve() with resize(), the code mostly works as 
expected, may still see &#39;Expression: vector subscript out of range&#39; 
sometimes, likely usually happened when moving the mouse cursor out of 
the frame, probably due to missing boundary checking. Updated source 
code was pushed to forked &lt;a href=&quot;https://github.com/quyq/2DLight-SDL&quot;&gt;https://github.com/quyq/2DLight-SDL&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;If you are using VSCode as editor like me, you may create task.json like this to allow building the project with MSBuild using shortcut &#39;ctrl+shift+b&#39; (the top half set build env for x86, the bottom half run MSBuild with the solution file):&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2.0.0&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;windows&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;options&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;shell&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;executable&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;cmd.exe&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;args&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/C&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// The path of batch file and platform parameter for setting the build env&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvarsall.bat&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;x86&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&amp;amp;&amp;amp;&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; },&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;tasks&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;shell&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;MSBuild.exe build active file&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;command&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;MSBuild.exe&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;args&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2DLight.sln&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;-p:Configuration=Release&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ],&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;problemMatcher&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;$msCompile&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;],&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;group&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;kind&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;build&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;isDefault&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;If want to use VSCode built-in debugger, may create launch.json as:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;0.2.0&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;configurations&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2DLight&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;cppvsdbg&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;request&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;launch&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;program&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2DLight.exe&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;args&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [],&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;stopAtEntry&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;cwd&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;${workspaceFolder}/Release&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;environment&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: [],&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;console&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;externalTerminal&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; ]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/4236112225680451003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/07/learning-sdl-part-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/4236112225680451003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/4236112225680451003'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/07/learning-sdl-part-i.html' title='Learning SDL Part I'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-5000084306319537996</id><published>2024-07-10T02:18:00.004-04:00</published><updated>2024-07-14T14:23:30.048-04:00</updated><title type='text'>Update Tanks (坦克大战) with network support</title><content type='html'>&lt;p&gt;With &lt;a href=&quot;https://dencode.blogspot.com/2024/06/revisit.html&quot;&gt;Revisit 坦克大战编程&lt;/a&gt;, can easily build Tanks on Windows or under WSL. However, with one player the game would be a bit boring and a bit frustrate; and with two player2 on same PC, it would be a bit crowd for four hands on one keyboard. If would be more attractive if two players can play together remotely, or even play against each other, would be much fun. So, we need to bring in network support. Would need to choose a&amp;nbsp; suitable networking library, (e.g., SDL_net, which complements SDL, or another networking library like Boost.Asio for C++). Need to initialize the networking in the application, setting up one instance as the server and the other as the client.&lt;/p&gt;&lt;p&gt;I haven&#39;t been using either network library. So will pick SDL_net since we already have used other library from SDL. SDL_net was moved to github as: &lt;a href=&quot;https://github.com/libsdl-org/SDL_net&quot;&gt;https://github.com/libsdl-org/SDL_net&lt;/a&gt;. Similar as other SDL libraries, I downloaded &lt;a class=&quot;Truncate&quot; data-turbo=&quot;false&quot; data-view-component=&quot;true&quot; href=&quot;https://github.com/libsdl-org/SDL_net/releases/download/release-2.2.0/SDL2_net-devel-2.2.0-VC.zip&quot; rel=&quot;nofollow&quot;&gt;
    &lt;span class=&quot;Truncate-text text-bold&quot; data-view-component=&quot;true&quot;&gt;SDL2_net-devel-2.2.0-VC.zip&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now it&#39;s time to deep dive to the code to understand the design. The main loop is &lt;span style=&quot;color: #2b00fe;&quot;&gt;App::run&lt;/span&gt; with state of &lt;span style=&quot;color: #2b00fe;&quot;&gt;m_app_state&lt;/span&gt; check/switch, &lt;span style=&quot;color: #2b00fe;&quot;&gt;eventProces&lt;/span&gt;, &lt;span style=&quot;color: #2b00fe;&quot;&gt;m_app_state-&amp;gt;update&lt;/span&gt;, &lt;span style=&quot;color: #2b00fe;&quot;&gt;m_app_state-&amp;gt;draw&lt;/span&gt;, and FPS control. &lt;span style=&quot;color: #2b00fe;&quot;&gt;m_app_state&lt;/span&gt; initially is pointing to an instance of &lt;span style=&quot;color: #2b00fe;&quot;&gt;Menu&lt;/span&gt;, then it is pointing to an instance of &lt;span style=&quot;color: #2b00fe;&quot;&gt;Game&lt;/span&gt;, &lt;span style=&quot;color: #2b00fe;&quot;&gt;Scores&lt;/span&gt; and &lt;span style=&quot;color: #2b00fe;&quot;&gt;Menu &lt;/span&gt;sequentially after invoke of &lt;span style=&quot;color: #2b00fe;&quot;&gt;nextState&lt;/span&gt;, which updates the state machine.&amp;nbsp;&lt;span style=&quot;color: #2b00fe;&quot;&gt;Menu&lt;/span&gt; is the state to allow user to select player and quit, &lt;span style=&quot;color: #2b00fe;&quot;&gt;Scores &lt;/span&gt;is the state to show the score. So we most are interested of the &lt;span style=&quot;color: #2b00fe;&quot;&gt;Game &lt;/span&gt;state. &lt;/p&gt;&lt;p&gt;It would be complex to maintain two state machine on two hosts, even one is a mirror of the other. Need to clone all object on fly, with dynamic create and destroy, and need to merge input from both side, and one side needs to be the master for random number generation, state control by user. Also consider network latency, might be a bit messy to maintain the sync between server and client. The easier approach would be let the master to maintain the state machine, for client side, just relay the input to server, and mirror the render result from server.&lt;/p&gt;(to be continue)&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/5000084306319537996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/07/update-tanks-with-network-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/5000084306319537996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/5000084306319537996'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/07/update-tanks-with-network-support.html' title='Update Tanks (坦克大战) with network support'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3829322243725297585</id><published>2024-06-30T19:11:00.004-04:00</published><updated>2024-06-30T19:11:58.293-04:00</updated><title type='text'> Program D-Link DCS-5010L - Part 3</title><content type='html'>&lt;p&gt;&amp;nbsp;As mentioned in &lt;a href=&quot;http://dencode.blogspot.com/2024/06/program-d-link-dcs-5010l-part-2.html&quot;&gt;Program D-Link DCS-5010L - Part 2&lt;/a&gt;, I wasn&#39;t able to successfully open DCS-5010L stream with OpenCV+GStreamer, so I&#39;m going to explore OpenCV+ffmpeg. Ffmpeg is famous OpenSource Multimedia framework which contains a set of utility with almost all codec supported. &lt;a href=&quot;https://stackshare.io/stackups/ffmpeg-vs-gstreamer&quot;&gt;Here&lt;/a&gt; is a Ffmpeg vs. GStreamer comparison.&lt;/p&gt;&lt;p&gt;To going this approach, there is &lt;a href=&quot;https://github.com/chenxinfeng4/ffmpegcv&quot;&gt;FfmpegCV&lt;/a&gt;, which might be served as OpenCV replacement with ffmpeg support, has compatible API as OpenCV. Here I&#39;m going to give it a try. Similar as using GStreamer, would need to install ffmpeg executable separately. Then do: &lt;code&gt;pip install ffmpegcv&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;This will install the stable version, without cuda acceleration as I don&#39;t have nVidia GPU. After trying around, I realized that I need to use this API to open the stream: &lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cap&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ffmpegcv&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;VideoCaptureStream&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;stream_url&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;However, I don&#39;t see how it can help to play the audio.&lt;/p&gt;&lt;p&gt;Then I turned to&lt;a href=&quot;https://pyav.org&quot;&gt; PyAV&lt;/a&gt;. With that, I figured out that the &#39;video.cgi&#39; would only provide video stream. Need to open &#39;audio.cgi&#39; for the audio stream which is in wave format.&lt;/p&gt;&lt;p&gt;I added my code to forked &lt;a href=&quot;https://github.com/quyq/dlink-dcs-python-lib&quot;&gt;dlink-dcs-python-lib github repository&lt;/a&gt;, with arrow key support for tile/pan the camera. There is no need to put the OpenCV video into a Tcl/tk gadget, but may create a TK GUI for setting configuration/options such as video file saving path, resolution, motion detecting and so on.&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3829322243725297585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/06/program-d-link-dcs-5010l-part-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3829322243725297585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3829322243725297585'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/06/program-d-link-dcs-5010l-part-3.html' title=' Program D-Link DCS-5010L - Part 3'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-4985903155731549832</id><published>2024-06-22T17:18:00.002-04:00</published><updated>2024-06-30T12:47:17.004-04:00</updated><title type='text'>Program D-Link DCS-5010L - Part 2</title><content type='html'>&lt;p&gt;OpenCV is mainly focusing on video. It does not support audio directly. To playback audio, would rely on ffmpeg or GStreamer. ffmpeg is mostly a standalone offline multimedia converting tools. OpenCV has GStreamer built-in support, but it is optional. I used pip installed opencv-python on Windows for Python 3.12, and GStreamer isn&#39;t enabled. May refer to &lt;a href=&quot;https://github.com/opencv/opencv-python&quot;&gt;github opencv-python&lt;/a&gt; and &lt;a href=&quot;https://discuss.bluerobotics.com/t/opencv-python-with-gstreamer-backend/8842&quot;&gt;https://discuss.bluerobotics.com/t/opencv-python-with-gstreamer-backend/8842&lt;/a&gt;. Even install the full package with &lt;code&gt;pip install opencv-contrib-python&lt;/code&gt; won&#39;t get GStream enabled CV2. Might need to build with source. Either way, would need to install GStreamer first, which is available here: &lt;a href=&quot;https://gstreamer.freedesktop.org/download&quot;&gt;https://gstreamer.freedesktop.org/download&lt;/a&gt;. To build GStreamer enabled opencv-python:&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span data-path=&quot;/t/opencv-python-with-gstreamer-backend/8842&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre data-code-wrap=&quot;shell&quot;&gt;&lt;code class=&quot;lang-nohighlight&quot; style=&quot;color: #2b00fe;&quot;&gt;git clone --recursive https://github.com/opencv/opencv-python.git&lt;br /&gt;cd .\opencv-python&lt;br /&gt;set CMAKE_ARGS=&quot;-DWITH_GSTREAMER=ON&quot;&lt;/code&gt;&lt;code class=&quot;lang-nohighlight&quot;&gt; or &lt;/code&gt;&lt;code class=&quot;lang-nohighlight&quot; style=&quot;color: #2b00fe;&quot;&gt;$env:CMAKE_ARGS=&quot;-DWITH_GSTREAMER=ON&quot;&lt;/code&gt;&lt;code class=&quot;lang-nohighlight&quot;&gt; for PowerShell&lt;/code&gt;&lt;code class=&quot;lang-nohighlight&quot; style=&quot;color: #2b00fe;&quot;&gt;&lt;br /&gt;pip wheel . --verbose&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The build gets setuptools 59.2.0, I&#39;m using miniConda and I&#39;m seeing &quot;&lt;span style=&quot;color: red;&quot;&gt;conda 24.1.2 requires setuptools&amp;gt;=60.0.0, but you have setuptools 59.2.0 which is incompatible&lt;/span&gt;&quot;. This is not my environment setuptools out-of-date issue, have tried: &lt;code&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;pip install setuptools --upgrade, python -m pip install pip --upgrade, conda update -n base setuptools&lt;/span&gt;&lt;/code&gt;, nothing works. And after this, seeing:&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;&amp;nbsp; Running command Getting requirements to build wheel&lt;br /&gt;&amp;nbsp; Traceback (most recent call last):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; File &quot;C:\ProgramData\miniconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py&quot;, line 353, in &amp;lt;module&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;br /&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; File &quot;C:\Users\squ\AppData\Local\Temp\pip-build-env-lekizdpu\overlay\Lib\site-packages\pkg_resources\__init__.py&quot;, line 2172, in &amp;lt;module&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; register_finder(pkgutil.ImpImporter, find_on_path)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^^^^^^^^^^^^^^^^^^^&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: courier;&quot;&gt;&amp;nbsp; AttributeError: module &#39;pkgutil&#39; has no attribute &#39;ImpImporter&#39;. Did you mean: &#39;zipimporter&#39;?&lt;br /&gt;&amp;nbsp; error: subprocess-exited-with-error&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Sounds same as &lt;a href=&quot;https://github.com/opencv/opencv-python/issues/988&quot;&gt;opencv-python issues 988&lt;/a&gt;, one comment there mentioned:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;background-color: #cccccc;&quot;&gt;I encountered the same problem while running &lt;code class=&quot;notranslate&quot;&gt;pip wheel . --verbose |&amp;amp; tee install_opencv.log&lt;/code&gt;. It worked after removing the &lt;code class=&quot;notranslate&quot;&gt;==59.2.0&quot;&lt;/code&gt; from the &lt;code class=&quot;notranslate&quot;&gt;&quot;setuptools==59.2.0&quot;&lt;/code&gt; &lt;a href=&quot;https://github.com/opencv/opencv-python/blob/4.x/pyproject.toml#L16&quot;&gt;https://github.com/opencv/opencv-python/blob/4.x/pyproject.toml#L16&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;The pyproject.toml file is under the root, with the setuptools line removed, the original problem is resolved. Build under Windows would need Visual Studio Build Tools (refer to &lt;a href=&quot;http://dencode.blogspot.com/2024/06/revisit.html&quot;&gt;Revisit 坦克大战编程&lt;/a&gt;)., need to do the build under the Native build environment. The build will try Ninja, Visual Studio and NMake generator, and will try from v144 to v141. I have v143, and have &quot;Developer Command Prompt for VS 2022&quot; environment launched, all Ninja and NMake will fail as no support of platform, VS v143 progress a bit far,&amp;nbsp; but still get error as:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;-- Trying &#39;Visual Studio 17 2022 x64 v143&#39; generator&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; -- &lt;span style=&quot;color: red;&quot;&gt;The C compiler identification is unknown&lt;br /&gt;&amp;nbsp; CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; No CMAKE_C_COMPILER could be found&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After some research, turns out Windows SDK is needed (I deselected it when installing Visual Studio Build Tools to save some space). It takes a while to build, depends on your computer. But it works. The opencv_python-*.whl file will be generated in the root folder. Just run pip to install it.&lt;/p&gt;&lt;p&gt;At beginning of the build, it will show the configuration, make sure Gstreamer is ON. It will stay OFF if GStreamer develop isn&#39;t installed. And with Gstreamer is enabled, I&#39;m getting runtime error as:&lt;/p&gt;&lt;pre class=&quot;notranslate&quot;&gt;&lt;code class=&quot;notranslate&quot; style=&quot;color: red;&quot;&gt;ImportError: DLL load failed while importing cv2: The specified module could not be found&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;which is similar as &lt;a href=&quot;https://github.com/opencv/opencv-python/issues/856&quot;&gt;opencv-python issues 856&lt;/a&gt;. Installed Microsoft Visual C++ Redistributable for Visual Studio 2022, but that didn&#39;t help. My Windows is not the &#39;N&#39; one, so not a problem of &lt;b&gt;&lt;a href=&quot;https://support.microsoft.com/en-us/help/3145500/media-feature-pack-list-for-windows-n-editions&quot; rel=&quot;nofollow&quot;&gt;Windows Media Feature Pack&lt;/a&gt;.&lt;/b&gt; I have tried the build whl before Gstreamer option enabled and not seeing problem, so I believe the problem is with GStreamer dll, but adding &quot;C:\gstreamer\1.0\msvc_x86_64\lib\gstreamer-1.0&quot; to path didn&#39;t help. Have to hook up Sysinternals&#39; Process Monitor, and it shows the run is looking for a bunch of gstreamer&#39;s runtime dll which were not in site-packages\cv2 folder. Added &quot;C:\gstreamer\1.0\msvc_x86_64\bin&quot; to environment variable &#39;PATH&#39; didn&#39;t help. Copy dlls over works, but not a clean way. Per &lt;a href=&quot;https://stackoverflow.com/questions/214852/python-module-dlls&quot;&gt;https://stackoverflow.com/questions/214852/python-module-dlls&lt;/a&gt;, since version python 3.8 they added a mechanism to do this more securely.
Read documentation on &lt;code&gt;os.add_dll_directory&lt;/code&gt; &lt;a href=&quot;https://docs.python.org/3/library/os.html#os.add_dll_directory&quot; rel=&quot;noreferrer&quot;&gt;https://docs.python.org/3/library/os.html#os.add_dll_directory&lt;/a&gt;. So doing this in code would work:&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;gst_root&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getenv&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;GSTREAMER_1_0_ROOT_MSVC_X86_64&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;C:/gstreamer/1.0/msvc_x86_64/&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;add_dll_directory&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;gst_root&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;bin&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;With Gstreamer enabled, I&#39;m still not able to open the stream with log as:&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;[ WARN:0@2.620] global cap_gstreamer.cpp:2840 cv::handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module souphttpsrc0 reported: Could not establish connection to server.&lt;br /&gt;[ WARN:0@2.623] global cap_gstreamer.cpp:1698 cv::GStreamerCapture::open OpenCV | GStreamer warning: unable to start pipeline&lt;br /&gt;[ WARN:0@2.623] global cap_gstreamer.cpp:1173 cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created&lt;br /&gt;[ WARN:0@2.623] global cap.cpp:206 cv::VideoCapture::open VIDEOIO(GSTREAMER): backend is generally available but can&#39;t be used to capture by name &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;A bit frustrate on this. The http url is all right as I can open it without using GStreamer. Most example I can find are using rtsp protocol but not http. Will leave this aside until I can figure out how to use GStreamer alone to open the stream. I&#39;m going to try OpenCV+ffmpeg next &lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/4985903155731549832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/06/program-d-link-dcs-5010l-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/4985903155731549832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/4985903155731549832'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/06/program-d-link-dcs-5010l-part-2.html' title='Program D-Link DCS-5010L - Part 2'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-595640847853339740</id><published>2024-06-21T23:50:00.002-04:00</published><updated>2024-06-22T00:13:56.364-04:00</updated><title type='text'>Program for D-Link DCS-5010L</title><content type='html'>&lt;p&gt;&amp;nbsp;D-Link DCS-5010L is a pretty old generation Pan &amp;amp; Tilt WIFI network camera. It is so old, only can be accessed with old IE web browser as it needs ActiveX. For Edge, may work by using IE mode. And almost impossible to use Firefox or Chrome browser. And for some feature and function, would need java installed. And it might not work due to old firmware and interface.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;D-Link&#39;s Android app even cannot connect to the camera. Give up on that as so frustrate. The TinyCam app can view and control the movement of the camera, but 
cannot change video resolution, codec type, and motion detection setting.&lt;/p&gt;&lt;p&gt;So come to the idea to use Python script to control and view the camera, more flexibility. Later, may think to make my own Android app for the camera. There is &lt;a href=&quot;https://github.com/scross01/dlink-dcs-python-lib&quot;&gt;github dlink-dcs-python-lib&lt;/a&gt; can be used as lib or reference. This lib has unit test code, but does not have stream video viewer code. Github copilot suggests to use opencv-python for video processing and use requests for handling HTTP requests. Code like below, worked quite well:&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;requests&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; numpy &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;np&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_HOST&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_HOST&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PORT&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_PORT&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;80&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_USER&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getenv&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_USER&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;admin&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PASS&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getenv&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_PASS&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# URL of the video stream&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;stream_url&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;http://&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_HOST&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PORT&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;/video.cgi&#39;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Start a session&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;session&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;requests&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Session&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;response&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;session&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;stream_url&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;stream&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;auth&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_USER&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PASS&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Check if the connection to the stream is successful&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;response&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;status_code&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bytes&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;chunk&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;response&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;iter_content&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;chunk_size&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1024&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;chunk&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.find(&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\xff\xd8&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;) &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# JPEG start&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.find(&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\xff\xd9&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;) &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# JPEG end&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;jpg&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;] &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Extract the JPEG image&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;bytes_data&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:] &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Remove the processed bytes&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;frame&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.imdecode(&lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;np&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.frombuffer(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;jpg&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;dtype&lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;np&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.uint8), &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.IMREAD_COLOR)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;frame&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;not&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;None&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.imshow(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;Video Stream&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;frame&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.waitKey(&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;0x&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;FF&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;ord&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;q&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;): &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Exit loop if &#39;q&#39; is pressed&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;break&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.destroyAllWindows()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Failed to connect to the stream.&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Above code is for viewing Motion Jpeg. To view h.264 stream, can use below code:&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# URL of the H.264 video stream&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_HOST&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_HOST&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PORT&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_PORT&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;80&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_USER&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getenv&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_USER&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;admin&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PASS&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;os&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getenv&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;CAM_PASS&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# URL of the video stream&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;stream_url&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;http://&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_USER&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PASS&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_HOST&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #4fc1ff;&quot;&gt;CAM_PORT&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;/video.cgi&#39;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Create a VideoCapture object&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cap&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.VideoCapture(&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;stream_url&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Check if camera opened successfully&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;not&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cap&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.isOpened():&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Error: Could not open video stream.&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Read until video is completed&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cap&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.isOpened():&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Capture frame-by-frame&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ret&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;frame&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cap&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.read()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ret&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Display the resulting frame&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.imshow(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;Video Stream&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;frame&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Press Q on keyboard to exit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.waitKey(&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;0x&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;FF&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #d4d4d4;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;ord&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;q&#39;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;break&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;break&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# When everything done, release the video capture object&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cap&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.release()&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;# Closes all the frames&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;cv2&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;.destroyAllWindows()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/595640847853339740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/06/program-for-d-link-dcs-5010l.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/595640847853339740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/595640847853339740'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/06/program-for-d-link-dcs-5010l.html' title='Program for D-Link DCS-5010L'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3971001002911595201</id><published>2024-06-19T00:49:00.002-04:00</published><updated>2024-06-29T16:42:26.594-04:00</updated><title type='text'>Revisit 坦克大战编程</title><content type='html'>&lt;p style=&quot;margin-left: 40px; text-align: left;&quot;&gt; In 2021 I posted two blog regarding building Tank natively with Visual Studio Build tools: &lt;br /&gt;&lt;/p&gt;&lt;ul class=&quot;posts&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://dencode.blogspot.com/2021/12/2.html&quot;&gt;教小朋友编程之坦克大战 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://dencode.blogspot.com/2021/12/blog-post.html&quot;&gt;教小朋友编程之坦克大战 1&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;When I trying to redo the build from scratch, I noticed some is missing in my post, for example, there is no &#39;Build&#39; folder by default. No need of &lt;b&gt;Cygwin&lt;/b&gt;. Also, I&#39;m planning to add network support, so player can play the game over internet. So I decide to make another blog to explore this. So here is a complete step by step for creating the build:&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Download Visual Studio Build Tools. Go to &lt;a href=&quot;https://visualstudio.microsoft.com/downloads/?q=build+tools&quot;&gt;https://visualstudio.microsoft.com/downloads/?q=build+tools&lt;/a&gt;, scroll down and looking for something like Build Tools for Visual Studio 2022. When install, only need select &quot;Desktop Develoment with C++&quot;, and for optional modules, the build environment such as MSVC v143 and C++ CMake tools for Windows are needed. All other can be deselected to save some space.&lt;/li&gt;&lt;li&gt;Run &quot;git clone https://github.com/quyq/Tanks.git&quot; in working directory to pull the source code &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Install SDL2 header file and lib. SDL2 binary can be download from:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.libsdl.org/release/&quot;&gt;https://www.libsdl.org/release/&lt;/a&gt;, such as &lt;a href=&quot;https://www.libsdl.org/release/SDL2-devel-2.30.4-VC.zip&quot;&gt;SDL2-devel-2.30.4-VC.zip&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.libsdl.org/projects/SDL_ttf/release&quot;&gt;https://www.libsdl.org/projects/SDL_ttf/release&lt;/a&gt;, such as &lt;a href=&quot;https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.22.0-VC.zip&quot;&gt;SDL2_ttf-devel-2.22.0-VC.zip&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;Truncate&quot; data-turbo=&quot;false&quot; data-view-component=&quot;true&quot; href=&quot;https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.8.0/SDL2_mixer-devel-2.8.0-VC.zip&quot; rel=&quot;nofollow&quot;&gt;
    &lt;span class=&quot;Truncate-text text-bold&quot; data-view-component=&quot;true&quot;&gt;https://github.com/libsdl-org/SDL_mixer/releases&lt;/span&gt;&lt;/a&gt;, such as &lt;span class=&quot;Truncate-text text-bold&quot; data-view-component=&quot;true&quot;&gt;&lt;a href=&quot;https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.8.0/SDL2_mixer-devel-2.8.0-VC.zip&quot;&gt;SDL2_mixer-devel-2.8.0-VC.zip&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.libsdl.org/projects/SDL_image/release&quot;&gt;https://www.libsdl.org/projects/SDL_image/release&lt;/a&gt;, such as&amp;nbsp; &lt;a href=&quot;https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.8.2-VC.zip&quot;&gt;SDL2_image-devel-2.8.2-VC.zip&lt;/a&gt;&lt;/li&gt;&lt;li&gt;May create a SDL folder in project root, and extract include and lib from above zip files (may delete those license files and optional files). Then change directory to &#39;include&#39; folder, create &#39;SDL2&#39; subfolder there, and move all header file to this &#39;SDL2&#39; folder as that is the path used in source code.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Start a Visual Studio Build Tools environment, and do:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;create &#39;build&#39; folder (such as &#39;mkdir build&#39;) under project root&lt;br /&gt;&lt;/li&gt;&lt;li&gt;change working directory to &#39;build&#39; (i.e. run &#39;cd build&#39;), then run:&lt;/li&gt;&lt;ul&gt;&lt;li&gt; cmake -G &quot;NMake Makefiles&quot; ..&lt;/li&gt;&lt;li&gt;Note: the two dots is a must which set the source folder as one level up, and this will create Makefile, out folder and several other files/folder under &#39;build&#39;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Run &#39;NMake&#39; which should create &#39;tank.exe&#39; under &#39;build/out&#39; folder. Resource files would be copied to there too.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;p&gt;For using &quot;NMake Makefiles&quot; generator, update settings.json as:&lt;/p&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;terminal.integrated.defaultProfile.windows&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Command Prompt&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div style=&quot;background-color: #1f1f1f; color: #cccccc; font-family: Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;&quot;cmake.generator&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;NMake Makefiles&quot;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The first line will change default terminal from &quot;Power Shell&quot; to &quot;Command Prompt&quot;. The next line select the generator. By default, it will use Visual Studio 16 2019 generator.&lt;/p&gt;&lt;p&gt;Build under WSL might be much easier, just install make/g++ and SDL2 develop package, then run make. If using Win11+WSL2, then no other extra work needed. If running WSL2 on Win10, may need update to latest WSL which has systemd support for GUI. And for audio, may follow instruction from &lt;a href=&quot;https://x410.dev/cookbook/wsl/enabling-sound-in-wsl-ubuntu-let-it-sing/&quot;&gt;https://x410.dev/cookbook/wsl/enabling-sound-in-wsl-ubuntu-let-it-sing/&lt;/a&gt; which has clear step by step instruction and does not open unnecessary permission for utilizing PulseAudio.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3971001002911595201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/06/revisit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3971001002911595201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3971001002911595201'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/06/revisit.html' title='Revisit 坦克大战编程'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3984116649385657580</id><published>2024-05-11T16:15:00.002-04:00</published><updated>2024-05-11T16:15:23.252-04:00</updated><title type='text'>Developing Android App with chart supported by MPAndroidChart</title><content type='html'>&lt;p&gt;&amp;nbsp;MPAndroidChart (&lt;a href=&quot;https://github.com/PhilJay/MPAndroidChart&quot;&gt;https://github.com/PhilJay/MPAndroidChart&lt;/a&gt;) is a powerful Android chart view / graph view library, supporting line- 
bar- pie- radar- bubble- and candlestick charts as well as scaling, 
panning and animations. As Open Source Project, the source code is free available from GitHub. There is &lt;a href=&quot;https://weeklycoding.com/mpandroidchart/&quot;&gt;general introduction&lt;/a&gt;, &lt;a href=&quot;https://jitpack.io/com/github/PhilJay/MPAndroidChart/v3.1.0/javadoc/&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;javadocs&lt;/strong&gt;&lt;/a&gt;, and example code. But I cannot find a user guide document for how to use this lib from an Android project. This project was actively development several years ago. So it is using Java and Gradle Groovy. Unfortunately, latest Android Studio only support Gradle Kotlin, and no longer provides option to select java as language. I was having a lot of problem to run the example code. Also tried following other online example/tutorial using MPAndroidChart, but no luck either. That makes me decide to make this post to write down notes I have.&lt;/p&gt;&lt;p&gt;First, as mentioned &lt;a href=&quot;https://malcolmmaima.medium.com/kotlin-implementing-a-barchart-and-piechart-using-mpandroidchart-8c7643c4ba75&quot;&gt;here &lt;/a&gt;and several other posts, you would need to add &#39;jitpack.io&#39; to your Project level Gradle file like this:&lt;/p&gt;&lt;pre&gt;repositories {
maven { url &#39;https://jitpack.io&#39; }
}&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;However, with recent Android Studio created project, if you add above to your root build.gradle file, you will get error like &quot;&lt;span style=&quot;color: red;&quot;&gt;Build was configured to prefer settings repositories over project repositories but repository &#39;maven&#39; was added by build file &#39;build.gradle&#39;&lt;/span&gt;&quot;. The correct way is adding it to the settings.gradle file like this:&lt;/p&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &#39;Droid Sans Mono&#39;,monospace; font-size: 7.5pt;&quot;&gt;dependencyResolutionManagement &lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #c77dbb;&quot;&gt;repositoriesMode&lt;/span&gt;.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)&lt;br /&gt;    repositories &lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &lt;/span&gt;google()&lt;br /&gt;        mavenCentral()&lt;br /&gt;        maven &lt;span style=&quot;font-weight: bold;&quot;&gt;{ &lt;/span&gt;url &lt;span style=&quot;color: #6aab73;&quot;&gt;&#39;https://jitpack.io&#39; &lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    }&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Second, if the project is using Gradle Kotlin, then would need to update settings.gradle.kts like this:&lt;/p&gt;&lt;div style=&quot;background-color: #1e1f22; color: #bcbec4;&quot;&gt;&lt;pre style=&quot;font-family: &#39;Droid Sans Mono&#39;,monospace; font-size: 7.5pt;&quot;&gt;dependencyResolutionManagement &lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #c77dbb; font-style: italic;&quot;&gt;repositoriesMode&lt;/span&gt;.set(RepositoriesMode.&lt;span style=&quot;color: #c77dbb; font-style: italic;&quot;&gt;FAIL_ON_PROJECT_REPOS&lt;/span&gt;)&lt;br /&gt;    repositories &lt;span style=&quot;font-weight: bold;&quot;&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;        &lt;/span&gt;google()&lt;br /&gt;        mavenCentral()&lt;br /&gt;        maven &lt;span style=&quot;font-weight: bold;&quot;&gt;{ &lt;/span&gt;setUrl(&lt;span style=&quot;color: #6aab73;&quot;&gt;&quot;https://jitpack.io&quot;&lt;/span&gt;) &lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;    }&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Note, the syntax is different for the two types gradle file.&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3984116649385657580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/05/developing-android-app-with-chart.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3984116649385657580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3984116649385657580'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/05/developing-android-app-with-chart.html' title='Developing Android App with chart supported by MPAndroidChart'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-7415577919430433941</id><published>2024-02-07T14:52:00.009-05:00</published><updated>2024-02-13T17:32:39.065-05:00</updated><title type='text'> RISC-v on ZC706 Evaluation Board - Part VI: Building fesvr-zynq with Petalinux</title><content type='html'>&lt;p&gt;&amp;nbsp;As of &lt;a href=&quot;http://dencode.blogspot.com/2024/01/risc-v-on-zc706-evaluation-board-part-v.html&quot;&gt;RISC-v on ZC706 Evaluation Board - Part V: Running Petalinux&lt;/a&gt;, I&#39;m back to square one, need to figure out how to build fesvr-zynq with Petalinux. First, set all environment as I can:&lt;/p&gt;&lt;pre class=&quot;pre codeblock&quot; style=&quot;-webkit-tap-highlight-color: transparent; -webkit-text-stroke-width: 0px; background-color: #eeeeee; box-sizing: border-box; color: #444444; font-family: monospace; font-size: 1em; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-left: 1em; margin-right: 1em; orphans: 2; overflow-x: auto; padding: 0.5em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;-webkit-tap-highlight-color: transparent; background-color: #eeeeee; box-sizing: border-box; font-family: monospace, monospace; font-size: 1em;&quot;&gt;source &amp;lt;path-to-installed-PetaLinux&amp;gt;/settings.sh
source &amp;lt;path-to-installed-PetaLinux&amp;gt;/components/yocto/buildtools/environment-setup-x86_64-petalinux-linux
source &amp;lt;path-to-installed-Xilinx&amp;gt;/Vitis/2022.1/settings64.sh
export PATH=$PATH:&amp;lt;path-to-installed-Xilinx&amp;gt;/Vitis/2022.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi
cd &amp;lt;path-to-fpga-zynq&amp;gt;/zc706 &amp;amp;&amp;amp; make fesvr-zynq
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Now, it complain:&lt;br /&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;arm-xilinx-linux-gnueabi-g++ -O2 -std=c++11 -Wall -L fpga-zynq/common/build -lfesvr -Wl,-rpath,/usr/local/lib -I fpga-zynq/common/csrc -I fpga-zynq/testchipip/csrc -I fpga-zynq/rocket-chip/riscv-tools/riscv-fesvr/ -Wl,-rpath,/usr/local/lib&amp;nbsp; -o fpga-zynq/common/build/fesvr-zynq /mnt/ext4/fpga-zynq/common/csrc/fesvr_zynq.cc fpga-zynq/common/csrc/zynq_driver.cc fpga-zynq/testchipip/csrc/blkdev.cc&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;Vitis/2022.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/x86_64-petalinux-linux/usr/lib/arm-xilinx-linux-gnueabi/gcc/arm-xilinx-linux-gnueabi/11.2.0/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;&amp;nbsp; 9 | # include_next &amp;lt;stdint.h&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^~~~~~~~~~&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Still sounds like some configuration is missing for the build. With export CFLAGS/CPPFLAGS/CXXFLAGS or set them in make cmdline to &quot;&lt;span style=&quot;color: #2b00fe;&quot;&gt;-I&amp;lt;path-to-Xilinx&amp;gt;/Vitis/2022.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/x86_64-petalinux-linux/usr/include&lt;/span&gt;&quot; doesn&#39;t help either.&lt;/p&gt;&lt;p&gt;Search shows me a link from lowRISC as &lt;a href=&quot;https://lowrisc.org/docs/tagged-memory-v0.1/fpga-fesvr/&quot;&gt;Building the front-end server&lt;/a&gt;:&lt;/p&gt;&lt;pre style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #212529; display: block; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; overflow: auto; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; color: #2b00fe; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;# set up the RISCV environment variables
# set up the Xilinx environment variables
cd $TOP/riscv-tools/riscv-fesvr
mkdir build_fpga
cd build_fpga
../configure --host=&lt;u&gt;&lt;span style=&quot;background-color: #fcff01;&quot;&gt;arm-xilinx-linux-gnueabi&lt;/span&gt;&lt;/u&gt;
make -j$(nproc)&lt;/code&gt;&lt;code style=&quot;box-sizing: border-box; color: inherit; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #21272d; font-family: &amp;quot;Source Sans Pro&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Once compilation has completed, you should find the following files:&lt;/p&gt;&lt;pre style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #212529; display: block; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; overflow: auto; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; color: #2b00fe; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;ls -l fesvr-zedboard
ls -l libfesvr.so&lt;/code&gt;&lt;code style=&quot;box-sizing: border-box; color: inherit; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #21272d; font-family: &amp;quot;Source Sans Pro&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;To copy your new front-end server to the FPGA image:&lt;/p&gt;&lt;pre style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #212529; display: block; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; overflow: auto; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; color: #2b00fe; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;cd $TOP/fpga-zynq/zedboard
make ramdisk-open
sudo cp $TOP/riscv-tools/riscv-fesvr/build_fpga/fesvr-zedboard \
  ramdisk/home/root/fesvr-zynq
sudo cp $TOP/riscv-tools/riscv-fesvr/build_fpga/libfesvr.so \
  ramdisk/usr/local/lib/libfesvr.so
make ramdisk-close
sudo rm -fr ramdisk&lt;/code&gt;&lt;code style=&quot;box-sizing: border-box; color: inherit; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #21272d; font-family: &amp;quot;Source Sans Pro&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;The proxy kernel (pk) used by the FPGA is the same one used in simulation. While not normally necessary, the proxy kernel can be recompiled using the following commands:&lt;/p&gt;&lt;pre style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #212529; display: block; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; overflow: auto; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; color: #2b00fe; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-size: inherit; overflow-wrap: break-word; word-break: normal;&quot;&gt;cd $TOP/fpga-zynq/zedboard
make ramdisk-open
sudo cp $TOP/riscv-tools/riscv-pk/build/pk ramdisk/home/root/pk
make ramdisk-close
sudo rm -fr ramdisk&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;lowRISC also has its risc-fesvr build instruction at &lt;a href=&quot;https://github.com/lowRISC/fpga-zynq/blob/master/README.md&quot;&gt;fpga-zynq/README.md&lt;/a&gt;, slightly different from &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq&quot;&gt;https://github.com/ucb-bar/fpga-zynq&lt;/a&gt;. And actually the two would behave same, if I use Xilinx 2016, which create a &#39;SDK&#39; folder, and after run &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;source SDK/2016.2/settings64.sh&lt;/span&gt;&#39;, &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;make fesvr-zynq&lt;/span&gt;&#39;:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;mkdir -p fpga-zynq/common/build&lt;br /&gt;cd fpga-zynq/common/build &amp;amp;&amp;amp; \&lt;br /&gt;fpga-zynq/rocket-chip/riscv-tools/riscv-fesvr/&lt;span style=&quot;background-color: #fcff01;&quot;&gt;configure \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --host=arm-xilinx-linux-gnueabi&lt;/span&gt; &amp;amp;&amp;amp; \&lt;br /&gt;make libfesvr.so&lt;br /&gt;checking build system type... x86_64-unknown-linux-gnu&lt;br /&gt;checking host system type... arm-xilinx-linux-gnueabi&lt;br /&gt;checking for arm-xilinx-linux-gnueabi-gcc... arm-xilinx-linux-gnueabi-gcc&lt;br /&gt;checking whether the C compiler works... no&lt;br /&gt;configure: error: in `fpga-zynq/common/build&#39;:&lt;br /&gt;configure: error: C compiler cannot create executables&lt;br /&gt;See `config.log&#39; for more details&lt;/span&gt;&lt;/p&gt;&lt;p&gt;same error as following the lowRISC instructions. Now need to figure out the problem from the config.log file. The log file indicates several warnings for same thing:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;fpga-zynq/rocket-chip/riscv-tools/riscv-fesvr/configure: line 2365: ~/SDK/2016.2/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-gcc: No such file or directory&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The gcc compiler does exist, but &lt;span style=&quot;color: #2b00fe;&quot;&gt;file ./arm-xilinx-linux-gnueabi-gcc&lt;/span&gt; shows:&lt;br /&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;./arm-xilinx-linux-gnueabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.16, stripped&lt;/span&gt;&lt;/p&gt;&lt;p&gt;which means I need to enable 32bit support in WSL as I mentioned in &lt;a href=&quot;https://dencode.blogspot.com/2020/06/windows10-ubuntu-wsl2.html&quot;&gt;Run Linux on Windows - WSL&lt;/a&gt;, by doing:&lt;/p&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot;&gt;&lt;pre class=&quot;lang-c s-code-block&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;code class=&quot;hljs language-c&quot;&gt;sudo dpkg --add-architecture i386
sudo apt-get update&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;code class=&quot;hljs language-c&quot;&gt;sudo apt install gcc:i386&lt;/code&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span class=&quot;comment-copy&quot;&gt;&lt;code&gt; gcc-multilib g++-multilib libc6:i386&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;With that, finally I&#39;m able to do &lt;span style=&quot;color: #2b00fe;&quot;&gt;make fesvr-zynq&lt;/span&gt;, &lt;span style=&quot;color: #2b00fe;&quot;&gt;fesvr-zynq&lt;/span&gt; and &lt;span style=&quot;color: #2b00fe;&quot;&gt;libfesvr.so&lt;/span&gt; would be generated under fpga-zynq/common/build folder. When copying &lt;span style=&quot;color: #2b00fe;&quot;&gt;fesvr-zynq&lt;/span&gt;, also need to copy &lt;code&gt;c&lt;span style=&quot;color: #2b00fe;&quot;&gt;ommon/build/libfesvr.so&lt;/span&gt;&lt;/code&gt; to &lt;code&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;/usr/local/lib&lt;/span&gt;&lt;/code&gt; on the board. As mentioned in above lowRISC instructions and &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq&quot;&gt;fpga-zynq&lt;/a&gt;, it is possible to recreate the ram disk, however, I&#39;m getting this when trying the commands under WSL: &lt;span style=&quot;color: red;&quot;&gt;cpio: dev/console: Cannot mknod: Operation not supported&lt;/span&gt;. Not sure whether this is WSL limitation or something I have missed. Give up on this for now. So I tried to copy the new executable. For that, might need to get IP from dhcp server if the board is connected to a network. Modifying /etc/network/interfaces with line &#39;iface eth0 inet dhcp&#39;, then do &#39;ifdown eth0&#39; and &#39;ifup eth0&#39; will temporarily work as the change of the interfaces file won&#39;t survive of a reboot. After successfully get IP from dhcp server, ssh may still not work with error: Unable to negotiate with a.b.c.d port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1. Can try tftp as:&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;cd ~ &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;tftp -g -r fesvr-zynq tftp_server&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;cd&amp;nbsp; /usr/local/lib&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;tftp -g -r&amp;nbsp;&lt;code&gt;&lt;span&gt;libfesvr.so&lt;/span&gt;&lt;/code&gt; tftp_server&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;Now, run fesvr-zynq without argument would get usage print out (with the original fesvr-zynq executable, used to get &quot;ERROR: No cores found&quot; error, same error as running &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;fesvr-zynq pk hello&lt;/span&gt;&#39;), but still not able to load the bbl or run the hello code.&lt;b&gt; &lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;PS&lt;/b&gt;: README.md in fpga-zynq/rocket-chip/riscv-tools/fpga-fesvr shows:&lt;/p&gt;&lt;p&gt;This repository is deprecated; it has been absorbed into the Spike repository (&lt;a href=&quot;https://github.com/riscv/riscv-isa-sim&quot;&gt;https://github.com/riscv/riscv-isa-sim&lt;/a&gt;).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/7415577919430433941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/02/risc-v-on-zc706-evaluation-board-part.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/7415577919430433941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/7415577919430433941'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/02/risc-v-on-zc706-evaluation-board-part.html' title=' RISC-v on ZC706 Evaluation Board - Part VI: Building fesvr-zynq with Petalinux'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3203215320323339462</id><published>2024-02-04T14:23:00.000-05:00</published><updated>2024-02-04T14:23:08.239-05:00</updated><title type='text'>Use Blink Mini camera without Amazon subscription</title><content type='html'>&lt;p&gt;Blink Mini is a cheap camera. Auto detection is a bit awkward to me as it always detected change out of the region I set for motion detecting. And after one year, recording video stop working without subscription.&lt;/p&gt;&lt;p&gt;Luckily, there are Open Source solution, using Python, likely are all based off the documentation at: &lt;a href=&quot;https://github.com/MattTW/BlinkMonitorProtocol&quot; rel=&quot;nofollow&quot;&gt;https://github.com/MattTW/BlinkMonitorProtocol&lt;/a&gt;:&amp;nbsp;&lt;/p&gt;&lt;p&gt;1) &lt;a href=&quot;https://pypi.org/project/blink-cameras/&quot;&gt;https://pypi.org/project/blink-cameras/&lt;/a&gt; I didn&#39;t try it as likely the development was paused since May 2019&lt;/p&gt;&lt;p&gt;2) &lt;a href=&quot;https://pypi.org/project/blinkpy&quot;&gt;https://pypi.org/project/blinkpy&lt;/a&gt;, github: &lt;a href=&quot;https://github.com/fronzbot/blinkpy&quot;&gt;https://github.com/fronzbot/blinkpy&lt;/a&gt;.&amp;nbsp; This library was built with the intention of allowing easy communication with Blink camera systems, specifically to support the &lt;a href=&quot;https://home-assistant.io/components/blink&quot; rel=&quot;nofollow&quot;&gt;Blink component&lt;/a&gt; in &lt;a href=&quot;https://home-assistant.io/&quot; rel=&quot;nofollow&quot;&gt;homeassistant&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Following is note for using blinkpy.&lt;/p&gt;&lt;p&gt;The &lt;a href=&quot;https://github.com/fronzbot/blinkpy&quot;&gt;blinkpy&lt;/a&gt; github site has a brief introduction for how to use it. Information at the pypi.org page likely is out-of date, as module &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;blinkpy&lt;/span&gt;&#39; has no attribute &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;Blink&lt;/span&gt;&#39;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;When I try the example code from the Readme, I got this:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: georgia;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Unclosed client session&lt;br /&gt;client_session: &amp;lt;aiohttp.client.ClientSession object at 0x00000201A7EE2310&amp;gt;&lt;br /&gt;Unclosed connector&lt;br /&gt;connections: [&#39;[(&amp;lt;aiohttp.client_proto.ResponseHandler object at 0x00000201A7EE6040&amp;gt;, 57822.015)]&#39;, &#39;[(&amp;lt;aiohttp.client_proto.ResponseHandler object at 0x00000201A7F22460&amp;gt;, 57822.593)]&#39;]&lt;br /&gt;connector: &amp;lt;aiohttp.connector.TCPConnector object at 0x00000201A7EE2370&amp;gt;&lt;br /&gt;Fatal error on SSL transport&lt;br /&gt;protocol: &amp;lt;asyncio.sslproto.SSLProtocol object at 0x00000201A7EE2970&amp;gt;&lt;br /&gt;transport: &amp;lt;_ProactorSocketTransport fd=844 read=&amp;lt;_OverlappedFuture cancelled&amp;gt;&amp;gt;&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt;&amp;nbsp; File &quot;C:\miniconda3\lib\asyncio\sslproto.py&quot;, line 684, in _process_write_backlog&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._transport.write(chunk)&lt;br /&gt;&amp;nbsp; File &quot;C:\miniconda3\lib\asyncio\proactor_events.py&quot;, line 359, in write&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._loop_writing(data=bytes(data))&lt;br /&gt;&amp;nbsp; File &quot;C:\miniconda3\lib\asyncio\proactor_events.py&quot;, line 395, in _loop_writing&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._write_fut = self._loop._proactor.send(self._sock, data)&lt;br /&gt;AttributeError: &#39;NoneType&#39; object has no attribute &#39;send&#39;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Sounds like the connection isn&#39;t successfully established? Actually it isn&#39;t. I added more code to read the camera name and attribute, and all these information can be read back correctly before above error showing up. Likely, above error raised at the closing or exiting. As a comment for &lt;a href=&quot;https://github.com/aio-libs/aiohttp/issues/5941&quot;&gt;aiohttp issues 5941&lt;/a&gt;, &lt;code class=&quot;notranslate&quot;&gt;loop._proactor&lt;/code&gt; is &lt;code class=&quot;notranslate&quot;&gt;None&lt;/code&gt; means &lt;code class=&quot;notranslate&quot;&gt;loop.close()&lt;/code&gt; was called before &lt;code class=&quot;notranslate&quot;&gt;session.close()&lt;/code&gt; call.&lt;br /&gt;
This is incorrect; and not aiohttp problem.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3203215320323339462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/02/use-blink-mini-camera-without-amazon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3203215320323339462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3203215320323339462'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/02/use-blink-mini-camera-without-amazon.html' title='Use Blink Mini camera without Amazon subscription'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3725688573708275564</id><published>2024-01-29T13:29:00.009-05:00</published><updated>2024-01-29T15:03:31.007-05:00</updated><title type='text'> RISC-v on ZC706 Evaluation Board - Part V: Running Petalinux</title><content type='html'>&lt;p&gt;Follow up on &lt;a href=&quot;http://dencode.blogspot.com/2023/12/risc-v-on-zc706-evaluation-board-part.html&quot;&gt;RISC-v on ZC706 Evaluation Board - Part IV: petalinux&lt;/a&gt;. As mentioned in the previous post, I didn&#39;t have tftp setup on my host PC. With &#39;BOOT.BIN&#39; copied to SD card, when booting up the board, U-Boot will look for tftp server, and trying to download Linux image from there. I guess it is possible to copy the Linux image to the SD card and boot from there. But let&#39;s setup the tftp server, then it be more convenience to update the Linux image without the need to transfer image to the SD card, why not? It&#39;s also possible to run SCP on the ZC706 EV board to copy image to SD card.&lt;/p&gt;&lt;p&gt;It&#39;s very easy to setup tftp (&lt;span face=&quot;sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: #f2f5f7; color: #362b36; display: inline; float: none; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Trivial File Transfer Protocol&lt;/span&gt;). Searching Internet may recommend tftp-hpa, which is &lt;span face=&quot;sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: #f2f5f7; color: #362b36; display: inline; float: none; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;a href=&quot;https://directory.fsf.org/wiki/Tftp-hpa&quot;&gt;an enhanced version of the BSD TFTP client and server. It possesses a number of bugfixes and enhancements over the original&lt;/a&gt;&lt;/span&gt;. May follow &lt;a href=&quot;https://linuxlink.timesys.com/docs/linux_tftp&quot;&gt;this&lt;/a&gt; to setup tftp backed by xinetd. If cannot update /etc/xinetd.d/tftp file, and &#39;&lt;span style=&quot;font-family: courier;&quot;&gt;sudo kill -HUP pid_of_inetd&lt;/span&gt;&#39; doesn&#39;t help, then try &#39;&lt;span style=&quot;font-family: courier;&quot;&gt;sudo kill -9 pid_of_inetd&lt;/span&gt;&#39;. Then restart xinetd with: &lt;span style=&quot;font-family: courier;&quot;&gt;sudo /etc/init.d/xinetd restart&lt;/span&gt;&lt;/p&gt;&lt;p&gt;There might be multiple tftp servers on the same subnet, so may need to specify the server on the ZC706 board. This can be done with cmd: &lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;-webkit-text-stroke-width: 0px; background: rgb(238, 238, 238) 0px 0px; border: medium; box-sizing: inherit; color: #4d4d4c; display: block; font-family: &amp;quot;Source Code Pro&amp;quot;, Monaco, Menlo, Consolas, monospace; font-size: 0.95em; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 22px; margin: 0px; orphans: 2; outline: 0px; overflow: auto; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;line&quot; style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-size: 15.2px; font-style: inherit; font-weight: inherit; height: 22px; margin: 0px; outline: 0px; padding: 0px 10px; vertical-align: baseline;&quot;&gt;setenv serverip 192.168.1.117&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Somehow, it still try to download from the other tftp server. So I tried to boot the image with QEMU:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;&amp;nbsp;source petalinux/settings.sh&lt;br /&gt;&amp;nbsp;petalinux-boot --qemu --prebuilt 2&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;It can boot to Linux, and will ask for login credential, and &#39;root/root&#39; doesn&#39;t work. Per &lt;a href=&quot;https://docs.xilinx.com/r/en-US/ug1144-petalinux-tools-reference-guide/Login-Changes&quot;&gt;https://docs.xilinx.com/r/en-US/ug1144-petalinux-tools-reference-guide/Login-Changes&lt;/a&gt;, the root account is disabled, &lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #444444; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;The default user is&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;ph uicontrol&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #444444; font-family: inherit; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; letter-spacing: normal; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;petalinux&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #444444; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and the password should be set on first boot&lt;/span&gt;&lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #444444; display: inline; float: none; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;. For me, using both 2 and 3 for prebuilt option will boot to Linux, but with 2, it will show more information for uboot boot.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Refer to QEMU User Documentation for how to use QEMU, such as:&lt;/p&gt;&lt;p&gt;To quit the emulation, press CTRL+A followed by X. To switch&lt;br /&gt;between the serial port and the monitor, use CTRL+A followed by C.&lt;/p&gt;&lt;p&gt;Now, back to the UBoot with tftp, do a power cycle and press &#39;space&#39; key within 3 seconds to pause UBoot. printenv shows:      &lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;arch=arm
baudrate=115200
board=zynq
board_name=zynq
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; i
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0 jtag mmc0 mmc1 qspi nand nor usb0 usb1 pxe dhcp
bootcmd=run distro_bootcmd
bootcmd_dhcp=devtype=dhcp; run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;set;
bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} &amp;amp;&amp;amp; source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_nand=nand info &amp;amp;&amp;amp; nand read ${scriptaddr} ${script_offset_f} ${script_size_f} &amp;amp;&amp;amp; echo NAND: Trying to boot script at ${;
bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} &amp;amp;&amp;amp; echo NOR: Trying to boot script at ${scriptaddr} &amp;amp;&amp;amp; sou;
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_qspi=sf probe 0 0 0 &amp;amp;&amp;amp; sf read ${scriptaddr} ${script_offset_f} ${script_size_f} &amp;amp;&amp;amp; echo QSPI: Trying to boot script at;
bootcmd_usb0=devnum=0; run usb_boot
bootcmd_usb1=devnum=1; run usb_boot
bootcmd_usb_dfu0=setenv dfu_alt_info boot.scr ram $scriptaddr $script_size_f &amp;amp;&amp;amp; dfu 0 ram 0 60 &amp;amp;&amp;amp; echo DFU0: Trying to boot scr;
bootcmd_usb_dfu1=setenv dfu_alt_info boot.scr ram $scriptaddr $script_size_f &amp;amp;&amp;amp; dfu 1 ram 1 60 &amp;amp;&amp;amp; echo DFU1: Trying to boot scr;
bootcmd_usb_thor0=setenv dfu_alt_info boot.scr ram $scriptaddr $script_size_f &amp;amp;&amp;amp; thordown 0 ram 0 &amp;amp;&amp;amp; echo THOR0: Trying to boot;
bootcmd_usb_thor1=setenv dfu_alt_info boot.scr ram $scriptaddr $script_size_f &amp;amp;&amp;amp; thordown 1 ram 1 &amp;amp;&amp;amp; echo THOR1: Trying to boot;
bootdelay=2
bootfile=pxelinux.0
bootfstype=fat
bootm_low=0
bootm_size=30000000
cpu=armv7
dfu_alt_info=mmc 0:1=boot.bin fat 0 1;u-boot.img fat 0 1
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
ethact=ethernet@e000b000
ethaddr=??:??:??:??:??:??
fdt_addr_r=0x1f00000
fdtcontroladdr=3eadf220
ipaddr=x.x.x.x
kernel_addr_r=0x2000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x0
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
modeboot=sdboot
pxefile_addr_r=0x2000000
ramdisk_addr_r=0x3100000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_t
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z &quot;${fdtfile}&quot; -a -n &quot;${soc}&quot;; then setenv efi_fdtfile ${soc}-${board}e
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; te
script_offset_f=9c0000
script_offset_nor=0xE2FC0000
script_size_f=0x40000
scriptaddr=3000000
serverip=y.y.y.y
soc=zynq
stderr=serial@e0001000
stdin=serial@e0001000
stdout=serial@e0001000
ubifs_boot=env exists bootubipart || env set bootubipart UBI; env exists bootubivol || env set bootubivol boot; if ubi part ${bi
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
vendor=xilinx
&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;color: #2b00fe;&quot;&gt;ethaddr&lt;/span&gt;, &lt;span style=&quot;color: #2b00fe;&quot;&gt;ipaddr &lt;/span&gt;and &lt;span style=&quot;color: #2b00fe;&quot;&gt;serverip &lt;/span&gt;are all set valid value, somehow it will keep trying a different tftp server. With uboot paused, manually issue &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;bootcmd&lt;/span&gt;&#39; will make it able to load from the desired tftp server. May get lot of network error, but after multiple retries, it should be able to load pxelinux.0, rootfs.cpio.gz.u-boot, zImage, system.dtb, then start the kernel successfully. uname -a =&amp;gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;Linux xilinx-zc706-2022_2 5.15.36-xilinx-v2022.2 #1 SMP PREEMPT Mon Oct 3 07:50:07 UTC 2022 armv7l GNU/Linux&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;So it is still running on the ARM core. Still need to figure out how to fix &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;fesvr-zynq &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;issue. Probably need to rebuild &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;fesvr-zynq &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;with petaliux SDK? Need to explore more.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3725688573708275564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2024/01/risc-v-on-zc706-evaluation-board-part-v.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3725688573708275564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3725688573708275564'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2024/01/risc-v-on-zc706-evaluation-board-part-v.html' title=' RISC-v on ZC706 Evaluation Board - Part V: Running Petalinux'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-8479370152864377797</id><published>2023-12-20T14:34:00.011-05:00</published><updated>2024-01-16T08:41:14.566-05:00</updated><title type='text'>RISC-v on ZC706 Evaluation Board - Part IV: petalinux</title><content type='html'>&lt;p&gt;&amp;nbsp;One year ago (Dec 2022) I made two posts to try modelling RISC-v on ZC706:&lt;/p&gt;&lt;ul class=&quot;posts&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-width: 0px; color: #333333; font-family: Georgia, serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style: none; margin: 0px; orphans: 2; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: -15px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li style=&quot;background: none; border-width: 0px; line-height: 1.5em; list-style: none; margin: 0.25em 0px; padding: 0px 0px 0.25em 1.3em; text-indent: -15px;&quot;&gt;&lt;a href=&quot;https://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-ii.html&quot; style=&quot;color: #336688;&quot;&gt;RISC-v on ZC706 Evaluation Board - Part II&lt;/a&gt;&lt;/li&gt;&lt;li style=&quot;background: none; border-width: 0px; line-height: 1.5em; list-style: none; margin: 0.25em 0px; padding: 0px 0px 0.25em 1.3em; text-indent: -15px;&quot;&gt;&lt;a href=&quot;https://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-i.html&quot; style=&quot;color: #336688;&quot;&gt;RISC-v on ZC706 Evaluation Board - Part I&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;Then later in this April I post &lt;a href=&quot;https://dencode.blogspot.com/2023/04/risc-v-on-zc706-evaluation-board-part.html&quot; style=&quot;color: #336688;&quot;&gt;RISC-v on ZC706 Evaluation Board - Part III&lt;/a&gt; to dive into generating FPGA bit stream with &lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Vivado 2016.2&lt;/span&gt;. It is a bit success, but eventually still running into issue: &quot;./fesvr-zynq pk hello&quot; still get &quot;ERROR: No cores found&quot;. As mentioned in the old post, likely that I need to setup PetaLinux. After several busy months, now I get some spare time to tackle this.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;fesvr-zynq probably was built from &lt;span style=&quot;color: #38761d;&quot;&gt;rocket-chip/riscv-tools/riscv-fesvr&lt;/span&gt;, but per &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq/issues/87&quot;&gt;https://github.com/ucb-bar/fpga-zynq/issues/87&lt;/a&gt;, the issue likely is not coming from this binary: &lt;br /&gt;&lt;/p&gt;&lt;b&gt;zhemao&lt;/b&gt; commented
        &lt;a class=&quot;Link--secondary js-timestamp&quot; href=&quot;https://github.com/ucb-bar/fpga-zynq/issues/87#issuecomment-403533097&quot; id=&quot;issuecomment-403533097-permalink&quot;&gt;Jul 9, 2018&lt;/a&gt;
          &lt;p dir=&quot;auto&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Sorry, I forgot to update all the binaries in the &lt;span style=&quot;color: #2b00fe;&quot;&gt;uramdisk.image.gz&lt;/span&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Could you please try the files in the master branch of fpga-images-zedboard? I&#39;ve tested them on my board and they seem to work. &lt;a href=&quot;https://github.com/ucb-bar/fpga-images-zedboard&quot;&gt;https://github.com/ucb-bar/fpga-images-zedboard&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;.&lt;/p&gt;&lt;p&gt;But likely &lt;a href=&quot;https://github.com/ucb-bar/fpga-images-zc706&quot;&gt;https://github.com/ucb-bar/fpga-images-zc706&lt;/a&gt; not updated. So likely what I need is using PetaLinux tools to build this &lt;span style=&quot;color: #2b00fe;&quot;&gt;uramdisk.image.gz&lt;/span&gt; for fpga-images-zc706.&lt;/p&gt;&lt;p&gt;Since I haven&#39;t been touching the zc706 board for a while, also it is
 now connected to a new Linux host, let me refresh the whole thing for reproducing the problem. With
 zc706 UART connected to Linux, once power up the board, kernel log 
shows:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;usb 2-10: new high-speed USB device number 7 using xhci_hcd&lt;br /&gt;&amp;nbsp;usb 2-10: New USB device found, idVendor=0403, idProduct=6014, bcdDevice= 9.00&lt;br /&gt;&amp;nbsp;usb 2-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3&lt;br /&gt;&amp;nbsp;usb 2-10: Product: Digilent USB Device&lt;br /&gt;&amp;nbsp;usb 2-10: Manufacturer: Digilent&lt;br /&gt;&amp;nbsp;usb 2-10: SerialNumber: 210251842966&lt;br /&gt;&amp;nbsp;ftdi_sio 2-10:1.0: FTDI USB Serial Device converter detected&lt;br /&gt;&amp;nbsp;usb 2-10: Detected FT232H&lt;br /&gt;&amp;nbsp;usb 2-10: FTDI USB Serial Device converter now attached to ttyUSB0&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This
 ttyUSB0 likely is the Jtag. Per host kernel log ([&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.208150] usb 
4-4: cp210x converter now attached to ttyUSB1), the Uart over USB device
 ttyUSB1 is there no matter the zc706 board is powered on or off. To 
connect to the Uart, would need terminal like putty(needs XServer) or 
minicom(runs in shell). I take minicom as I&#39;m connecting the host with 
ssh. Run: sudo minicom -s to setup serial port.&lt;/p&gt;&lt;p&gt;Once connected, it
 would prompt zynq login, use root/root which is default credential. If 
Ethernet cable is connected, then can use ssh to login the board, the 
default IP is 192.168.1.5 (refer to the &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq&quot;&gt;fpga-zynq project page&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: times; font-size: small;&quot;&gt;With the h/w environment ready, now let&#39;s start the PetaLinux adventure.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;I have downloaded&amp;nbsp;&lt;/span&gt;&lt;a data-original-title=&quot;PetaLinux Installer&quot; data-toggle=&quot;tooltip&quot; href=&quot;https://www.xilinx.com/member/forms/download/xef.html?filename=petalinux-v2023.2-10121855-installer.run&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #008282; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline: none; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;PetaLinux Tools Installer&lt;/a&gt;&lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #171c2d; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;and&amp;nbsp;&lt;/span&gt;&lt;a data-original-title=&quot;This BSP contains:   Hardware: This design uses vivado board presets with Zynq-7000 PS block (DDR, UART, SD, QSPI, Ethernet etc.) and AXI GPIO connected with led_4bits, dip_switches_4bits, gpio_sws_3bits.     Software: FSBL, U-Boot, Linux, device-tree (includes open-amp), rootfs (minimal packages).     Pre-built Images: Ready to test images bitstream, FSBL, U-Boot, Linux and rootfs for booting U-Boot and Linux.&quot; data-toggle=&quot;tooltip&quot; href=&quot;https://www.xilinx.com/member/forms/download/xef.html?filename=xilinx-zc706-v2023.2-10140544.bsp&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #008282; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline: none; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;ZC706 BSP&lt;/a&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt; from&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #336688; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Xilinx site&lt;/a&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt; several months&lt;/span&gt; back. The site&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: times; font-size: small;&quot;&gt;&lt;span&gt; also provides common images for Embedded Vitis Platforms. And per note:&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;i&gt;The ‘common image’ packages contain a prebuilt Linux kernel and root file system that can be used with any Zynq™, Zynq™ MP or Versal board for embedded Vitis platform developers.&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;i&gt;&lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; display: inline; float: none; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;These files need to be copied to an SD flash card along with the platform specific boot image (boot.bin) available from the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-platforms.html&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; outline: none; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Vitis™ Embedded Platform&lt;/a&gt;&lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; display: inline; float: none; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;page. &lt;/span&gt;&lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; display: inline; float: none; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Also included is the ‘sysroot’ required for embedded Vitis platform application development. The sdk.sh script must to be used to setup the compressed Yocto Project SDK on a Linux development host properly&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;i&gt;...&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #a64d79; display: inline; float: none; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;u&gt;PetaLinux Tools installation is not necessary to use the common images&lt;/u&gt;&lt;/span&gt;&lt;/i&gt;. &lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #171c2d; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Licenses and sources used to create the common image content is provided&lt;/span&gt;. This is a bit confusing. Which do we really need? Regarding Vivado v.s. Vitis, Digilent has a &lt;a href=&quot;https://digilent.com/blog/whats-different-between-vivado-and-vitis/&quot;&gt;page of explanation&lt;/a&gt;: &lt;i&gt;&lt;span face=&quot;soleil, Arial, Helvetica, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #212529; display: inline; float: none; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Fundamentally, the differences are down to the perspective of the developer using the tool. Vivado offers a hardware-centric approach to designing hardware, while Vitis offers a software-centric approach to developing *both* hardware and software&lt;/span&gt;&lt;/i&gt;. Sounds like we don&#39;t need Vitis stuff?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: times; font-size: small;&quot;&gt;&lt;span&gt;To start the journey, I&#39;m following &lt;a href=&quot;https://docs.xilinx.com/r/en-US/ug1144-petalinux-tools-reference-guide&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #008282; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline: none; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;UG1144 - PetaLinux Tools Documentation Reference Guide&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;To setup working environment, run: &lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;pre codeblock&quot; style=&quot;-webkit-tap-highlight-color: transparent; -webkit-text-stroke-width: 0px; background-color: #eeeeee; box-sizing: border-box; color: #444444; font-family: monospace; font-size: 1em; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-left: 1em; margin-right: 1em; orphans: 2; overflow-x: auto; padding: 0.5em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;-webkit-tap-highlight-color: transparent; background-color: #eeeeee; box-sizing: border-box; font-family: monospace, monospace; font-size: 1em;&quot;&gt;source &amp;lt;path-to-installed-PetaLinux&amp;gt;/settings.sh&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To use PetaLinux SDK, run:&lt;/p&gt;&lt;pre class=&quot;pre codeblock&quot; style=&quot;-webkit-tap-highlight-color: transparent; -webkit-text-stroke-width: 0px; background-color: #eeeeee; box-sizing: border-box; color: #444444; font-family: monospace; font-size: 1em; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-left: 1em; margin-right: 1em; orphans: 2; overflow-x: auto; padding: 0.5em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;-webkit-tap-highlight-color: transparent; background-color: #eeeeee; box-sizing: border-box; font-family: monospace, monospace; font-size: 1em;&quot;&gt;source &amp;lt;path-to-installed-PetaLinux&amp;gt;/components/yocto/buildtools/environment-setup-x86_64-petalinux-linux&lt;/code&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: times;&quot;&gt;The first is creating PetaLinux project with zc706 BSP: &lt;/span&gt;&lt;pre class=&quot;pre codeblock&quot; style=&quot;-webkit-tap-highlight-color: transparent; -webkit-text-stroke-width: 0px; background-color: #eeeeee; box-sizing: border-box; color: #444444; font-family: monospace; font-size: 1em; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-left: 1em; margin-right: 1em; orphans: 2; overflow-x: auto; padding: 0.5em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code style=&quot;-webkit-tap-highlight-color: transparent; background-color: #eeeeee; box-sizing: border-box; font-family: monospace, monospace; font-size: 1em;&quot;&gt;petalinux-create -t project -s &amp;lt;path-to-bsp&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;As the user guide said, using &lt;span style=&quot;color: #2b00fe;&quot;&gt;-p&lt;/span&gt; to specify the platform architecture, such as &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;-p arm&lt;/span&gt;&#39; for Zynq and &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;-p aarch64&lt;/span&gt;&#39; for Zynq UltraScale+ MPSoC, may save a little disk space. Also tftp server is preferred, &lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #444444; display: inline; float: none; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Without a TFTP service, you cannot download Linux system images to the target system using the U-Boot network/TFTP capabilities. This can be ignored for other boot modes.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;The user guide mentioned exporting hardware platform to PetaLinux project, which can be done from Vivado menu File=&amp;gt;Export=&amp;gt;Export Hardware=&amp;gt;choice of &#39;Pre-synthesis&#39; and &#39;Include bitstream&#39;, no idea, so I selected the 2nd options to include more. This step generates &lt;span style=&quot;color: #2b00fe;&quot;&gt;rocketchip_wrapper.xsa&lt;/span&gt; file.&amp;nbsp;&lt;p&gt;The user guide also mentioned creating project with template, I guess that is for complexity, since I already created project from BSP, I don&#39;t see a need of that.&lt;/p&gt;&lt;p&gt;Run &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;petalinux-config --get-hw-description ../fpga-zynq/zc706/zc706_rocketchip_ZynqFPGAConfig/rocketchip_wrapper.xsa&lt;/span&gt;&#39; to launch system config. There is lot of setting, and likely can keep the default setting per the User Guide.&lt;/p&gt;&lt;p&gt;Run &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;petalinux-build&lt;/span&gt;&#39; to build images and it will take a while (will perform a lot of download as well), with 4232 tasks in my case.&lt;/p&gt;&lt;p&gt;The project folder will hold pre-built image once created, even before performing the build. Description of images can be found from the &lt;span style=&quot;color: #38761d;&quot;&gt;README&lt;/span&gt; under the root of the project.&amp;nbsp;The build will generate new images to images/linux folder, such as:&lt;span style=&quot;color: #2b00fe;&quot;&gt; zynq_fsbl.elf, image.ub, zImage, uImage, u-boot.elf,&amp;nbsp; system.dtb&lt;/span&gt;, and &lt;span style=&quot;color: #2b00fe;&quot;&gt;rootfs.tar.gz&lt;/span&gt;, which might be the replacement of  &lt;span style=&quot;color: #2b00fe;&quot;&gt;uramdisk.image.gz&lt;/span&gt;? The fpga-zynq project&amp;nbsp; zc706/fpga-images-zc706 contains files as:&lt;br /&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;boot.bif&lt;br /&gt;boot.bin&lt;br /&gt;devicetree.dtb&lt;br /&gt;uImage&lt;br /&gt;uramdisk.image.gz&lt;br /&gt;boot_image&lt;br /&gt;|-FSBL.elf&lt;br /&gt;|-rocketchip_wrapper.bit&lt;br /&gt;|-u-boot.elf&lt;/span&gt;&lt;/p&gt;&lt;p&gt;So the boot_image folder contains FSBL, FPGA bitstream and U-Boot.&lt;/p&gt;&lt;p&gt;The&amp;nbsp;  &lt;span style=&quot;color: #2b00fe;&quot;&gt;uramdisk.image.gz&lt;/span&gt; seems is not a normal gzip archive as I cannot open it with 7-zip, therefore cannot confirm whether it is rootfs.tar.gz from the build. Following &lt;a href=&quot;https://xilinx.github.io/Embedded-Design-Tutorials/docs/2022.1/build/html/docs/Introduction/Zynq7000-EDT/4-linux-for-zynq.html&quot;&gt;https://xilinx.github.io/Embedded-Design-Tutorials/docs/2022.1/build/html/docs/Introduction/Zynq7000-EDT/4-linux-for-zynq.html&lt;/a&gt;, I packed the boot.bin with following:&lt;/p&gt;&lt;pre&gt;&lt;span class=&quot;nb&quot; style=&quot;color: #2b00fe;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt; images/linux&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;petalinux-package --boot --fsbl zynq_fsbl.elf --fpga system.bit --u-boot u-boot.elf&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Then copy the generated &quot;BOOT.BIN&quot; to SD card, yes, the name is all in capital.&lt;/p&gt;&lt;p&gt;Some Acronym for PetaLinux: &lt;br /&gt;&lt;/p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;FSBL&lt;/b&gt;: First Stage BootLoader&lt;/span&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;PMU&lt;/b&gt;: Platform Management Unit, &lt;/span&gt;manage and perform the multi-staged booting process&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;TF-A&lt;/b&gt;: Trust Firmware-A, a transparent bare-metal application layer executed in Exception Level 3 (EL3) on the APU.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;BIF&lt;/b&gt;: Bootgen Image Format&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;APU&lt;/b&gt;: Application Processing Unit&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;RPU&lt;/b&gt;: Realtime Processing Unit&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;b&gt;MCS&lt;/b&gt;: might stand for Intel Micro Computer Set, which is file ext name for Intel Hex (refer to &lt;a href=&quot;https://en.wikipedia.org/wiki/Intel_hex&quot;&gt;wikipedia&lt;/a&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/8479370152864377797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2023/12/risc-v-on-zc706-evaluation-board-part.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/8479370152864377797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/8479370152864377797'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2023/12/risc-v-on-zc706-evaluation-board-part.html' title='RISC-v on ZC706 Evaluation Board - Part IV: petalinux'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-4115203867746355350</id><published>2023-09-02T13:41:00.008-04:00</published><updated>2023-09-05T14:10:03.578-04:00</updated><title type='text'>Developing code with WSL: 2 - Install docker</title><content type='html'>&lt;p&gt;(continue of &lt;a href=&quot;http://dencode.blogspot.com/2023/09/developing-code-with-wsl-1-common.html&quot;&gt;Developing code with WSL: 1 - Common problem&lt;/a&gt;) &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The easy way to try docker with WSL would be installing Docker Desktop on host Windows. Some detail can be found from Microsoft tutorial site: &lt;a href=&quot;https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers&quot;&gt;Get started with Docker containers on WSL | Microsoft Learn&lt;/a&gt;. But if you prefer to decouple Docker with the host OS, just want to install everything under WSL, you can following Docker Linux installation instruction to just install Docker engine, such as instruction here: &lt;a _ngcontent-ng-c101275479=&quot;&quot; href=&quot;https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository&quot; rel=&quot;noopener&quot; tabindex=&quot;-1&quot; target=&quot;_blank&quot;&gt;https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;p&gt;When run&amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;~$ docker run hello-world&lt;/span&gt;, might get this:&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red; font-family: courier;&quot;&gt;docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red; font-family: courier;&quot;&gt;See &#39;docker run --help&#39;.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;If google this, may see this got asked on Stack Overflow: &lt;a href=&quot;https://stackoverflow.com/questions/71815092/docker-cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-th&quot;&gt;ubuntu - docker：Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The suggestion there is run: &lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: #2b00fe; font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;systemctl start docker&lt;/code&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt; &amp;amp;&amp;amp;&lt;/code&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt; &lt;/code&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: #2b00fe; font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;systemctl enable docker&lt;/code&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;.&lt;span style=&quot;font-family: times;&quot;&gt; Then may get another error message:&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: red; font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;System has not been booted with systemd as init system (PID 1). Can&#39;t operate.&lt;br /&gt;Failed to connect to bus: Host is down&lt;/code&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: times; font-size: small;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #111111; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;This is due to limitation of older version of WSL which does not support systemd, or systemd flag has not been set in WSL setting. In that case, try: &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #2b00fe; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;sudo service docker start&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #111111; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;. Systemd is supported with WSL version 0.67.6 or newer(reference from Microsoft: &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: times; font-size: small;&quot;&gt;&lt;a href=&quot;https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/&quot;&gt;Systemd support is now available in WSL! - Windows Command Line&lt;/a&gt;&lt;span face=&quot;-apple-system, Roboto, SegoeUI, &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Meiryo UI&amp;quot;, Meiryo, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #111111; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;)&lt;/span&gt;&lt;span face=&quot;-apple-system, Roboto, SegoeUI, &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Meiryo UI&amp;quot;, Meiryo, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #111111; display: inline; float: none; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;. As the link mentioned, if checking WSL version with &#39;wsl --version&#39; failed, it means &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline; float: none; font-family: times; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;you are running the in-Windows version of WSL and need to&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://devblogs.microsoft.com/commandline/a-preview-of-wsl-in-the-microsoft-store-is-now-available/#how-to-install-and-use-wsl-in-the-microsoft-store&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #005da6; font-family: times; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: underline; text-indent: 0px; text-transform: none; white-space: normal; word-break: break-word; word-spacing: 0px;&quot;&gt;upgrade to the Store version&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span face=&quot;-apple-system, Roboto, SegoeUI, &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Meiryo UI&amp;quot;, Meiryo, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #111111; display: inline; float: none; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: times;&quot;&gt;&lt;span face=&quot;-apple-system, Roboto, SegoeUI, &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Meiryo UI&amp;quot;, Meiryo, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.7); color: #111111; display: inline; float: none; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;To enable systemd:&lt;/span&gt;&lt;/span&gt;You will need to edit the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://docs.microsoft.com/windows/wsl/wsl-config#wslconf&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #005da6; text-decoration: underline; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;wsl.conf&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;file to ensure systemd starts up on boot.Add these lines to the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class=&quot;prettyprinted&quot; style=&quot;box-sizing: border-box; color: #cc0000; font: 1em SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; word-break: break-word;&quot;&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box;&quot;&gt;/etc/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;wsl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;conf&lt;/span&gt;&lt;/code&gt;&lt;span&gt; &lt;/span&gt;with sudo:&lt;/p&gt;&lt;pre class=&quot;prettyprinted&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: #f0f0f0; border-radius: 10px; border: 0px; box-sizing: border-box; color: #212529; display: block; font: 14.875px SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; letter-spacing: normal; margin-bottom: 1rem; margin-top: 0px; orphans: 2; overflow: auto; padding: 10px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;bash prettyprinted&quot; style=&quot;box-sizing: border-box; color: inherit; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size: inherit; font-stretch: normal; font-style: normal; font-variant: normal; font-variation-settings: normal; font-weight: normal; line-height: normal; word-break: normal;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;boot&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black;&quot;&gt;
systemd&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;With that, run&amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;~$ docker run hello-world&lt;/span&gt; would get this:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;~$ sudo docker run hello-world&lt;br /&gt;Unable to find image &#39;hello-world:latest&#39; locally&lt;br /&gt;latest: Pulling from library/hello-world&lt;br /&gt;719385e32844: Pull complete&lt;br /&gt;Digest: sha256:dcba6daec718f547568c562956fa47e1b03673dd010fe6ee58ca806767031d1c&lt;br /&gt;Status: Downloaded newer image for hello-world:latest&lt;br /&gt;&lt;br /&gt;Hello from Docker!&lt;br /&gt;This message shows that your installation appears to be working correctly. &lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you prefer not to use &#39;sudo&#39; for docker operation, may refer to this&lt;a href=&quot;https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo&quot; target=&quot;_blank&quot;&gt; &#39;Ask Ubuntu&#39; post&lt;/a&gt;. It works for docker 0.5.3 and up. Basically you would need to add the desired user to &#39;docker&#39; group, like this:&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sudo gpasswd -a $USER docker&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Then re-login this user if it is the current user. For WSL, you can run &#39;logout&#39; and you will automatically get re-login. After login, should be able to run docker command without &#39;sudo&#39;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;code style=&quot;background-color: transparent; border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: var(--ff-mono); font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: var(--_pr-code-fs); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/4115203867746355350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2023/09/developing-code-with-wsl-2-install.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/4115203867746355350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/4115203867746355350'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2023/09/developing-code-with-wsl-2-install.html' title='Developing code with WSL: 2 - Install docker'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-6268004195208359270</id><published>2023-09-02T13:38:00.007-04:00</published><updated>2024-02-12T17:33:16.398-05:00</updated><title type='text'>Developing code with WSL: 1 - Common problem</title><content type='html'>&lt;p&gt;&amp;lt;WIP&amp;gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The two things Microsoft did recent years I would give a thumb up are WSL and VisualStudio Code. Both are gaining a lot of attraction along all software developers, I believe. Now, I&#39;d like to make some note with WSL first. I had talked about WSL before, as:&lt;br /&gt;Feb 2019: &lt;a href=&quot;http://dencode.blogspot.com/2019/02/running-linux-on-windows.html&quot;&gt;Running Linux on Windows&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Jun 2020: &lt;a href=&quot;http://dencode.blogspot.com/2020/06/windows10-ubuntu-wsl2.html&quot;&gt;Windows10 运行Ubuntu - WSL2&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;I&#39;m going to create multiple post for what I learned while using WSL. This first one would be some common tips.&amp;nbsp;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Accessing files cross host Windows and WSL filesystem&amp;nbsp;&lt;/h3&gt;&lt;p&gt;share folder: /mnt/c&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;running windows application &lt;br /&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;share git: cache issue&lt;/h3&gt;&lt;p class=&quot;xmsonormal&quot;&gt;If user frequently or occasionally would switch 
between Windows and WSL, and run git command, may see that git will 
refresh index. As explained from &lt;a class=&quot;external-link&quot; href=&quot;https://stackoverflow.com/questions/59061816/git-forces-refresh-index-after-switching-between-windows-and-linux&quot; rel=&quot;nofollow&quot;&gt;this stackoverflow post&lt;/a&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;The thing you&#39;re using here, which Git variously calls the &lt;em&gt;index&lt;/em&gt;, the &lt;em&gt;staging area&lt;/em&gt;, or the &lt;em&gt;cache&lt;/em&gt;, does in fact contain cache data.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The cache data that it contains is the result of system calls.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The system call data returned by a Linux system is &lt;em&gt;different&lt;/em&gt; from the system call data returned by a Windows system.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Especially
 if have VS-Code installed on Windows, and w/o using WSL extension to 
access the repo, VS-Code will run the windows native git.exe with the 
GitLens extension.&lt;/p&gt;&lt;p&gt;Another thing user may need to consider is: 
under WSL, the host Windows&#39; git.exe is faster than the WSL linux git. 
So a simple and efficient solution would be set an alias by adding one 
line in ~/.bashrc file with:&lt;/p&gt;&lt;p&gt;alias git=git.exe&lt;/p&gt;&lt;p&gt;With this, 
under WSL it will always invoke the Windows git.exe for fetching the 
index. It&#39;s faster, no refresh when switch between Windows and WSL 
Linux. A side note is this won&#39;t work for tcl/expect which is used by 
the autobld script. This probably is due to the way how WSL is handling 
running navtive Windows app under WSL. For that, we can take the other 
approach mentioned in the same stackoverflow post: set environment 
variable of GIT_INDEX_FILE&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;Makefile : Clock skew detected&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/13745645/makefile-clock-skew-detected&quot;&gt;Makefile : Clock skew detected - Stack Overflow&lt;/a&gt;, this is not the case for WSL build. In fact: &lt;a href=&quot;https://stackoverflow.com/questions/65086856/wsl2-clock-is-out-of-sync-with-windows&quot;&gt;WSL2 Clock is out of sync with Windows - Stack Overflow&lt;/a&gt;. Another easy way to get around this is: close all WSL session, then from a console, issue: wsl --shutdown. Then open a new WSL session, it will automatically sync the time with Windows host.&lt;br /&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;GUI: Windows 11, or MobaXterm and 32 bit/64bit executable&lt;/h3&gt;&lt;p style=&quot;text-align: left;&quot;&gt;Refer to&amp;nbsp;&lt;a href=&quot;https://dencode.blogspot.com/2020/06/windows10-ubuntu-wsl2.html&quot;&gt;Run Linux on Windows - WSL&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/6268004195208359270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2023/09/developing-code-with-wsl-1-common.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/6268004195208359270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/6268004195208359270'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2023/09/developing-code-with-wsl-1-common.html' title='Developing code with WSL: 1 - Common problem'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-6416041927429710202</id><published>2023-04-06T17:50:00.010-04:00</published><updated>2024-02-14T12:34:29.353-05:00</updated><title type='text'>RISC-v on ZC706 EVB - Part III: build w/ Win11/WSL2/Vivado 2016.2</title><content type='html'>&lt;p&gt;&amp;nbsp;Continue my journey with of &lt;a href=&quot;http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-ii.html&quot;&gt;RISC-v on ZC706 Evaluation Board - Part II&lt;/a&gt;. Finally get some spare time can back on this. Since it may need some effort to get PetaLinux setup and debug the executable issue, I changed my focus to setup Vivado 2016.2 on another Windows 11 + WSL2 PC. Luckily Xilinx_Vivado_SDK_2016.2_0605_1.tar.gz is just around 11.1GB, even much smaller than 2016.4 package. And I chose WSL2 as on Windows 11 it support GUI, and would be less hassle do the build under Linux. However, I do run into several problem with fresh installed WSL2:&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Got &#39;&lt;span style=&quot;color: red;&quot;&gt;libawt_xawt.so: libXrender.so.1: cannot open shared object file: No such file or directory&lt;/span&gt;&#39; when running Vivado xsetup to install Vivado. Search from internet shows I need to do &quot;&lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt-get install libxrender1&quot;&lt;/span&gt; , and that did work. Then hit next issue as below:&lt;/li&gt;&lt;li&gt;Got &#39;&lt;span style=&quot;color: red;&quot;&gt;libawt_xawt.so: libXtst.so.6: cannot open shared object file: No such file or directory&lt;/span&gt;&#39;, turns out that I need do &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt install libxtst6&lt;/span&gt;&#39;. Then next issue:&lt;/li&gt;&lt;li&gt;Got &#39;&lt;span style=&quot;color: red;&quot;&gt;libawt_xawt.so: libXi.so.6: cannot open shared object file: No such file or directory&lt;/span&gt;&#39;, need to do &quot;&lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt install libxi6&lt;/span&gt;&quot;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;With that, xsetup is up and running. For installing option, I selected Vivado HL Design Edition as the WebPACK one might not have all features I need, and I don&#39;t need DSP support (for choices, may refer to &lt;a href=&quot;https://www.css-techhelp.com/post/xilinx-2016-4-webpack-vivado-and-sdk-install-on-windows-7-sp1&quot;&gt;Xilinx 2016.4 WebPACK Vivado and SDK Install on Windows 7 SP1 (css-techhelp.com)&lt;/a&gt; for more detail). Then the installation stuck with the flash screen for quite long time, which made me doubt whether it hanged or crashed. Luckily, it is not. After a while, the install option diag shows up, and I can select and continue the installation. At beginning I checked the option for creating Desktop shortcut, but not sure where it will go as I don&#39;t have Ubuntu Desktop installed. The installation not proceeding after a while, with log file name showed in console. By checking the log, &lt;u&gt;likely there is &lt;span style=&quot;color: red;&quot;&gt;issue with the shortcut&lt;/span&gt;&lt;/u&gt;. So re-run the installer, this time, &lt;span style=&quot;color: #2b00fe;&quot;&gt;not select the shortcut and create group box&lt;/span&gt;, however, installer still hangs, and log file shows it probably is running tcl script for generating the device list:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #800180;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;Executing script Generating installed device list: /home/Suser/Vivado/2016.2/bin/vivado [-nolog, -nojournal, -mode, batch, -source, /home/$user/.xinstall/Vivado_2016.2/scripts/xlpartinfo.tcl, -tclargs, /home/&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;$user&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;/Vivado/2016.2/data/parts/installed_devices.txt]&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;Tried &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt install tcl&lt;/span&gt;&#39; but doesn&#39;t help. If manually run about&amp;nbsp; line, will get:&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;application-specific initialization failed: couldn&#39;t load file &quot;librdi_commontasks.so&quot;: libncurses.so.5: cannot open shared object file: No such file or directory&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Per this &lt;a href=&quot;https://support.xilinx.com/s/question/0D52E00006iHpeSSAS/librdicommontasksso-and-libtinfoso5-are-not-being-loaded-when-i-start-vivado-and-so-vivado-fails-to-run?language=en_US&quot;&gt;link&lt;/a&gt;, need to do: &lt;span face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #2b00fe; display: inline; float: none; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;sudo apt install libncurses5&lt;/span&gt;&lt;/p&gt;With that, I successfully installed Vivado 2016.2 under WSL. Then I start to pull fpga-zynq.git and build with it as described in &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq#2-pushing-your-rocket-modifications-to-the-fpga&quot;&gt;fpga-zynq: 2) Pushing your rocket modifications to the FPGA&lt;/a&gt;, steps as:&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Start WSL Ubuntu terminal &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;git clone https://github.com/ucb-bar/fpga-zynq.git&lt;/span&gt; to /mnt/c/workspace which can be easily accessed from Windows&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Run &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;s&lt;span style=&quot;color: #2b00fe;&quot;&gt;udo apt install openjdk-8-jdk-headless&lt;/span&gt;; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;sudo update-alternatives --install &quot;/usr/bin/java&quot; &quot;java&quot; &quot;/usr/lib/jvm/java-8-openjdk-amd64/bin/java&quot; 1&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;/span&gt;&lt;/span&gt;There is a strange thing happened. To install JDK8 under WSL, sometime would need to do sudo apt update, but somehow WSL give me an error as: &quot;&lt;span style=&quot;color: red;&quot;&gt;Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease is not valid yet (invalid for another 1d 3h 20min 52s). Updates for this repository will not be applied.&lt;/span&gt;&quot;. &lt;a href=&quot;https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/&quot;&gt;https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/&lt;/a&gt; gives me a clue on this: my WSL clock is skewed for some reason and it is lagged more than 1 day. So have to issue &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;wsl --shutdown&lt;/span&gt;&#39; then restart WSL to fix the problem &lt;br /&gt;&lt;/li&gt;&lt;li&gt;For fresh WSL, would need do: &lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt install make&lt;/span&gt; &lt;br /&gt;&lt;/li&gt;&lt;li&gt;cd to git repo &lt;span style=&quot;color: #2b00fe;&quot;&gt;zc706&lt;/span&gt; subfolder, run: &lt;br /&gt;&lt;pre class=&quot;notranslate&quot;&gt;&lt;code style=&quot;color: #2b00fe;&quot;&gt;make init-submodules&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Run below command, may get a lot of warn and error related to sbt, probably just ignore them:&lt;br /&gt;&lt;pre class=&quot;notranslate&quot;&gt;&lt;code style=&quot;color: #2b00fe;&quot;&gt;make rocket&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;If see &lt;span style=&quot;color: red;&quot;&gt;Cannot run program &quot;dtc&quot;&lt;/span&gt;, do: &lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt install device-tree-compiler&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Once &#39;make rocket&#39; successfully completed, run Vivado setting script in the installation path such as: &lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;source &lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;~/Vivado/2016.2/&lt;/span&gt;&lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;settings64.sh&lt;/span&gt;&lt;/li&gt;&lt;li&gt;run&amp;nbsp; &lt;span style=&quot;color: #2b00fe; font-family: courier;&quot;&gt;make project&lt;/span&gt;, and soon will see something like &#39;&lt;span style=&quot;color: #04ff00;&quot;&gt;Wrote&amp;nbsp; : &amp;lt;/mnt/c/code/fpga-zynq/zc706/zc706_rocketchip_ZynqFPGAConfig/zc706_rocketchip_ZynqFPGAConfig.srcs/sources_1/bd/system/system.bd&amp;gt;&lt;/span&gt;&#39; at the end. &#39;system.bd&#39; is folder contains system folder.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Now run &lt;pre class=&quot;notranslate&quot;&gt;&lt;code&gt;make fpga-images-zc706/boot.bin&lt;/code&gt;&lt;/pre&gt;will see output like:&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;color: #800180; font-family: times;&quot;&gt;Successfully read diagram &amp;lt;system&amp;gt; from BD file &amp;lt;/mnt/c/code/fpga-zynq/zc706/zc706_rocketchip_ZynqFPGAConfig/zc706_rocketchip_ZynqFPGAConfig.srcs/sources_1/bd/system/system.bd&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #800180; font-family: times;&quot;&gt;Verilog Output written to : /mnt/c/code/fpga-zynq/zc706/zc706_rocketchip_ZynqFPGAConfig/zc706_rocketchip_ZynqFPGAConfig.srcs/sources_1/bd/system/hdl/system.v&lt;br /&gt;Verilog Output written to : /mnt/c/code/fpga-zynq/zc706/zc706_rocketchip_ZynqFPGAConfig/zc706_rocketchip_ZynqFPGAConfig.srcs/sources_1/bd/system/hdl/system_wrapper.v&lt;br /&gt;Wrote&amp;nbsp; : &amp;lt;/mnt/c/code/fpga-zynq/zc706/zc706_rocketchip_ZynqFPGAConfig/zc706_rocketchip_ZynqFPGAConfig.srcs/sources_1/bd/system/system.bd&amp;gt;&lt;br /&gt;INFO: [BD 41-1029] Generation completed for the IP Integrator block proc_sys_reset_0 .&lt;br /&gt;WARNING: [xilinx.com:ip:processing_system7:5.5-1] system_processing_system7_0_0: The Zynq BFM requires an AXI BFM license to run. Please ensure that you have purchased and setup the AXI BFM license prior to running simulation with this block. Please contact your Xilinx sales office for more information on purchasing this license&lt;br /&gt;INFO: [BD 41-1029] Generation completed for the IP Integrator block processing_system7_0&lt;/span&gt;&lt;span style=&quot;color: #800180; font-family: times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #800180; font-family: times;&quot;&gt;...&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #800180; font-family: times;&quot;&gt;Attempting to get a license for feature &#39;Synthesis&#39; and/or device &#39;xc7z045&#39;&lt;br /&gt;WARNING: [Common 17-348] Failed to get the license for feature &#39;Synthesis&#39; and/or device &#39;xc7z045&#39;&lt;br /&gt;3 Infos, 1 Warnings, 0 Critical Warnings and 1 Errors encountered.&lt;br /&gt;synth_design failed&lt;br /&gt;ERROR: [Common 17-345] A valid license was not found for feature &#39;Synthesis&#39; and/or device &#39;xc7z045&#39;. Please run the Vivado License Manager for assistance in determining&lt;br /&gt;which features and devices are licensed for your system.&lt;br /&gt;Resolution: Check the status of your licenses in the Vivado License Manager. For debug help search Xilinx Support for &quot;Licensing FAQ&quot;.&lt;br /&gt;INFO: [Common 17-206] Exiting Vivado at Fri Apr&amp;nbsp; 7 19:48:34 2023...&lt;br /&gt;[Fri Apr&amp;nbsp; 7 19:48:34 2023] synth_1 finished&lt;br /&gt;wait_on_run: Time (s): cpu = 00:00:00.15 ; elapsed = 00:00:28 . Memory (MB): peak = 1186.469 ; gain = 0.000 ; free physical = 241 ; free virtual = 1777&lt;br /&gt;# launch_runs impl_1 -to_step write_bitstream&lt;br /&gt;ERROR: [Common 17-70] Application Exception: Failed to launch run &#39;impl_1&#39; due to failures in the following run(s):&lt;br /&gt;synth_1&lt;br /&gt;These failed run(s) need to be reset prior to launching &#39;impl_1&#39; again.&lt;/span&gt;&lt;br /&gt;...&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Likely would need a license to run synth and impl. As mentioned at &lt;a href=&quot;https://dzone.com/articles/create-a-bootbin-program-an-sd-card-and-boot-a-zc7&quot;&gt;https://dzone.com/articles/create-a-bootbin-program-an-sd-card-and-boot-a-zc7&lt;/a&gt;, &lt;i&gt;The ZC706 has an XC7Z045-2FFG900 C SoC. This chip is not supported in WebPACK (see [&lt;a href=&quot;https://www.xilinx.com/products/design-tools/vivado/vivado-webpack.html#architecture&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;]) like the chip on the ZC702. You can get a 30-day license at [&lt;a href=&quot;https://www.xilinx.com/support/licensing_solution_center.html&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;]&lt;/i&gt;.&lt;/p&gt;&lt;p&gt;Next, might see &#39;bootgen: command not found&#39;. This could happen if user didn&#39;t run the Xilinx Vivado settings64.sh shell script, or XiLinx SDK wasn&#39;t installed. If the SDK is installed, bootgen should be available under Vivado/2016.2/bin folder. Without SDK, make boot.bin would fail. So need to select SDK during installation as below (I only select Zynq-7000 to save space and installing time. Also, not select Acquire or Manage a License Key as I will deal with that separately):&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK_qaJw5KxcQgGeFQ1edHLOcJKVyoSJxVy0Ejhu01qp3JLIQZrTF36RjKiWmh62fxSFCwjwg2iQTTuNbP0uW9towfY8Eo9hwlSoh-Z28zwMAZ2v5jWSrHjzj7hed7PXUcCZf1xBklz_VJdIADpjAVpvtljDl5_63Aleg40Xx8zszZSum1j7uSzdTdY/s755/Screenshot%202023-04-09%20162914.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;425&quot; data-original-width=&quot;755&quot; height=&quot;219&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK_qaJw5KxcQgGeFQ1edHLOcJKVyoSJxVy0Ejhu01qp3JLIQZrTF36RjKiWmh62fxSFCwjwg2iQTTuNbP0uW9towfY8Eo9hwlSoh-Z28zwMAZ2v5jWSrHjzj7hed7PXUcCZf1xBklz_VJdIADpjAVpvtljDl5_63Aleg40Xx8zszZSum1j7uSzdTdY/w389-h219/Screenshot%202023-04-09%20162914.jpg&quot; width=&quot;389&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;If already have Vivado installed, then it won&#39;t allow you to re-install at same location. Would need to launch Vivado, then goto help-&amp;gt;Add Design Tools or Devices...-&amp;gt;Check SDK and click install.&lt;/p&gt;&lt;p&gt;After all this, finally can successfully build the boot.bin. With this boot.bin copied to SD card, it can successfully boot the PetaLinux (connect the Uart USB, and use root/root to login). But running &quot;./fesvr-zynq pk hello&quot; still get &quot;ERROR: No cores found&quot;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Also tried following the prompted message for the problem 5 mentioned in&lt;a href=&quot;http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-i.html&quot;&gt; Risc-v on zc706 evaluation board - Part I&lt;/a&gt;: &lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;ERROR: [BD_TCL-109] This script was 
generated using Vivado &amp;lt;2016.2&amp;gt; and is being run in &amp;lt;2022.1&amp;gt;
 of Vivado. Please run the script in Vivado &amp;lt;2016.2&amp;gt; then open the
 design in Vivado &amp;lt;2022.1&amp;gt;. Upgrade the design by running &quot;Tools 
=&amp;gt; Report =&amp;gt; Report IP Status...&quot;, then run write_bd_tcl to create
 an updated script&lt;/span&gt;.&lt;/span&gt; &lt;/p&gt;&lt;p&gt;I opened the project file &lt;span style=&quot;color: #6aa84f;&quot;&gt;zc706_rocketchip_ZynqFPGAConfig.xpr&lt;/span&gt; created by 2016.2 Vivado with 2022.1 Vivado, and keep the project as &lt;b&gt;Read-only&lt;/b&gt; while the new version Vivado prompt for choice. It would still treat the board type as error: 

&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;color: red;&quot;&gt;[Board 49-67] The board_part definition was not found for xilinx.com:zc706:part0:1.0. This can happen sometimes when you use custom board part. You can resolve this issue by setting &#39;board.repoPaths&#39; parameter, pointing to the location of custom board files. Valid board_part values can be retrieved with the &#39;get_board_parts&#39; Tcl command&lt;/span&gt;.

&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;For this, no need to update update &lt;span style=&quot;color: #6aa84f;&quot;&gt;zc706/src/tcl/zc706_rocketchip_ZynqFPGAConfig.tcl&lt;/span&gt;, but update the project xpr file directly as it is XML format, just update &lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&amp;lt;Option Name=&quot;BoardPart&quot; Val=&quot;xilinx.com:zc706:part0:1.0&quot;/&amp;gt;&lt;/span&gt; to &lt;/span&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;xilinx.com:zc706:part0:&lt;span style=&quot;background-color: #fcff01;&quot;&gt;1.4&lt;/span&gt;&lt;/span&gt;. For above update instruction, I cannot find &#39;write_bd_tcl&#39; script, but did find there is a man doc as &lt;span style=&quot;color: #6aa84f;&quot;&gt;Vivado/2022.1/doc/eng/man/write_bd_tcl&lt;/span&gt;. And &#39;Report IP&#39; now is under menu/Report but not Tools. Open the Tcl Console (menu/Window-&amp;gt;Tcl Console), issue command write_bd_tcl with output filename. It may prompt:&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;ERROR: [BD 5-229] Please open or create a block design first&lt;/span&gt;. So need to select from left Flow Navigator-&amp;gt;IP INTEGRATOR-&amp;gt; Open Block Design before running the write_bd_tcl command.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/6416041927429710202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2023/04/risc-v-on-zc706-evaluation-board-part.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/6416041927429710202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/6416041927429710202'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2023/04/risc-v-on-zc706-evaluation-board-part.html' title='RISC-v on ZC706 EVB - Part III: build w/ Win11/WSL2/Vivado 2016.2'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK_qaJw5KxcQgGeFQ1edHLOcJKVyoSJxVy0Ejhu01qp3JLIQZrTF36RjKiWmh62fxSFCwjwg2iQTTuNbP0uW9towfY8Eo9hwlSoh-Z28zwMAZ2v5jWSrHjzj7hed7PXUcCZf1xBklz_VJdIADpjAVpvtljDl5_63Aleg40Xx8zszZSum1j7uSzdTdY/s72-w389-h219-c/Screenshot%202023-04-09%20162914.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-593415611913579029</id><published>2023-03-04T20:50:00.005-05:00</published><updated>2023-03-11T18:32:20.850-05:00</updated><title type='text'>CodeFormer: AI Face Enhancement, 图片人脸智能增强</title><content type='html'>最近看到这个由周尚长博士领队的几位南洋理工大学S-Lab成员开发的开源程序，用来恢复和增强照片中的人脸，效果惊人。可以点进以下3分半的you-tube看一下就知我所言不虚(包括1927 Fifth Solvay International Conference群英会的照片)。
&lt;p&gt;&lt;iframe allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/d3VDpkXlueI&quot; title=&quot;YouTube video player&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir=&quot;auto&quot;&gt;&lt;a href=&quot;https://imgsli.com/MTI3NTE2&quot; rel=&quot;nofollow&quot;&gt;&lt;img height=&quot;226px&quot; src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/imgsli_1.jpg&quot; style=&quot;max-width: 100%;&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://imgsli.com/MTI3NTE1&quot; rel=&quot;nofollow&quot;&gt;&lt;img height=&quot;226px&quot; src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/imgsli_2.jpg&quot; style=&quot;max-width: 100%;&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://imgsli.com/MTI3NTIw&quot; rel=&quot;nofollow&quot;&gt;&lt;img height=&quot;226px&quot; src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/imgsli_3.jpg&quot; style=&quot;max-width: 100%;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;&lt;a aria-hidden=&quot;true&quot; class=&quot;anchor&quot; href=&quot;https://github.com/sczhou/CodeFormer#face-restoration&quot; id=&quot;user-content-face-restoration&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; class=&quot;octicon octicon-link&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h4 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;Face Restoration&lt;/h4&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/restoration_result1.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/restoration_result1.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/restoration_result2.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/restoration_result2.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/restoration_result3.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/restoration_result3.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/restoration_result4.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/restoration_result4.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;&lt;a aria-hidden=&quot;true&quot; class=&quot;anchor&quot; href=&quot;https://github.com/sczhou/CodeFormer#face-color-enhancement-and-restoration&quot; id=&quot;user-content-face-color-enhancement-and-restoration&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; class=&quot;octicon octicon-link&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h4 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;Face Color Enhancement and Restoration&lt;/h4&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/color_enhancement_result1.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/color_enhancement_result1.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/color_enhancement_result2.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/color_enhancement_result2.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;&lt;a aria-hidden=&quot;true&quot; class=&quot;anchor&quot; href=&quot;https://github.com/sczhou/CodeFormer#face-inpainting&quot; id=&quot;user-content-face-inpainting&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; class=&quot;octicon octicon-link&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;/svg&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h4 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;Face Inpainting&lt;/h4&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/inpainting_result1.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/inpainting_result1.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/sczhou/CodeFormer/blob/master/assets/inpainting_result2.png&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;https://github.com/sczhou/CodeFormer/raw/master/assets/inpainting_result2.png&quot; style=&quot;max-width: 100%;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://shangchenzhou.com/projects/CodeFormer/&quot;&gt;https://shangchenzhou.com/projects/CodeFormer/&lt;/a&gt; 是项目主页，有些简单介绍。code的github网址是：&lt;a href=&quot;https://github.com/sczhou/CodeFormer&quot;&gt;https://github.com/sczhou/CodeFormer&lt;/a&gt;，附有简单的安装使用说明，除了要git clone代码，和下载样本数据外，主要是要设置conda。关于conda, 可参见：&lt;a href=&quot;http://dencode.blogspot.com/2021/01/tensorflow-python.html&quot;&gt;学习TensorFlow - 设置Python环境&lt;/a&gt;。Miniconda就足够了（参见https://stackoverflow.com/questions/45421163/anaconda-vs-miniconda）&lt;/p&gt;&lt;p&gt;&lt;code&gt;注意，CUDA不是必须的，像我的电脑是AMD APU，不支持nVida的CUDA，也可以完美的运行CodeFormer。&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;当你用CodeFormer转化自己的照片时，最初可能并不会注意到转化后的照片有什么不一样，记住，一定要zoom in，放大再放大，看细节,一定有惊喜。 &lt;br /&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;除了增强照片，Codeformer还支持video的人脸增强(需要引入FFMpeg)。有空要研究研究怎样加入AMD ROMc的支持，加快在我的AMD计算机上的处理速度。 &lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;notranslate&quot;&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/593415611913579029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2023/03/codeformer-ai-face-enhancement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/593415611913579029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/593415611913579029'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2023/03/codeformer-ai-face-enhancement.html' title='CodeFormer: AI Face Enhancement, 图片人脸智能增强'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/d3VDpkXlueI/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3452675361569898494</id><published>2023-01-04T11:59:00.006-05:00</published><updated>2023-01-04T11:59:29.917-05:00</updated><title type='text'>Setup ssh tunnel/port forward on Windows</title><content type='html'>&lt;p&gt;&amp;nbsp;Reference link:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm&quot;&gt;https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://linuxize.com/post/how-to-setup-ssh-tunneling/&quot;&gt;https://linuxize.com/post/how-to-setup-ssh-tunneling/&lt;/a&gt;&lt;/p&gt;Make sure for Cygwin, has openssh installed. Then run &lt;br /&gt;&lt;pre dir=&quot;ltr&quot;&gt;ssh-host-config&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;*** Query: Enter the value of CYGWIN for the daemon: [] binmode ntsec&lt;/p&gt;&lt;p&gt;Then run this to start the service: &lt;code dir=&quot;ltr&quot;&gt;cygrunsrv -S sshd&lt;/code&gt; &lt;/p&gt;&lt;p&gt;May need to change Windows firewall setting to open the port 22.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;SSH tunneling or SSH port forwarding is a method of creating an 
encrypted SSH connection between a client and a server machine through 
which services ports can be relayed.&lt;/p&gt;&lt;p&gt;There are three types of SSH port forwarding:&lt;span class=&quot;ezoic-adpicker-ad&quot; id=&quot;ezoic-pub-ad-placeholder-138&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Local
 Port Forwarding. - Forwards a connection from the client host to the 
SSH server host and then to the destination host port.&lt;/li&gt;&lt;li&gt;Remote Port Forwarding. - Forwards a port from the server host to the client host and then to the destination host port.&lt;/li&gt;&lt;li&gt;Dynamic Port Forwarding. - Creates a SOCKS proxy server that allows communication across a range of ports.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3452675361569898494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2023/01/setup-ssh-tunnelport-forward-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3452675361569898494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3452675361569898494'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2023/01/setup-ssh-tunnelport-forward-on-windows.html' title='Setup ssh tunnel/port forward on Windows'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-1873124710608899697</id><published>2022-12-30T15:35:00.005-05:00</published><updated>2024-02-07T11:02:38.128-05:00</updated><title type='text'>RISC-v on ZC706 Evaluation Board - Part II</title><content type='html'>&lt;p&gt;With &lt;a href=&quot;http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-i.html&quot;&gt;RISC-v on ZC706 Evaluation Board - Part I&lt;/a&gt;, I was successfully building the boot.bin. I thought I got the work done, but realized it was not when I tried the binary I made: after replaced the &#39;boot.bin&#39; on the SD card with the one I built, the Init LED turns to green for about 1 second, then turns to red, no output from UART port, so something is wrong. Actually there is a warning while making the boot.bin:&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;[WARNING]: Partition FSBL.elf.0 range is overlapped with partition rocketchip_wrapper.bit.0 memory range&lt;br /&gt;[INFO]&amp;nbsp;&amp;nbsp; : Bootimage generated successfully&lt;/span&gt;&lt;/div&gt;&lt;p&gt;Would need to check the partition layout.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Beside this problem, I&#39;m seeing another issue when playing more, with the fetched SD binaries: running &quot;./fesvr-zynq pk hello&quot; got &quot;ERROR: No cores found&quot;, same error for any command with fesvr-zynq. Search the symptom returned same issue:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/chipsalliance/rocket-chip/issues/1390&quot;&gt;https://github.com/chipsalliance/rocket-chip/issues/1390&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq/issues/87&quot;&gt;https://github.com/ucb-bar/fpga-zynq/issues/87&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Likely there is an update for zedboard but not for zc706. So likely will have to build this fesvr-zynq by myself. Run &#39;make fesvr-zynq&#39; lead me realized that all sub-modules of rocket-chip/riscv-tools didn&#39;t get cloned, especially &#39;riscv-fesvr&#39; which is needed for making fesvr-zynq. With that repo cloned, the build did make some progress, but eventually would complain cannot find &#39;arm-xilinx-linux-gnueabi-g++&#39;. Though I did find the executable under Xilinx Vitis, running environment setup script, or even adding the path of the executable won&#39;t help, as it needs the PetaLinux build environment, which seems hasn&#39;t been fully integrated to Xilinx Vitis. Have to download PetaLinux Tools from &lt;a href=&quot;https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html&quot;&gt;Xilinx site&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Will update this once get some progress on this.&lt;/p&gt;&lt;p&gt;Below is &lt;b&gt;quoted &lt;/b&gt;from &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq&quot;&gt;&lt;b&gt;https://github.com/ucb-bar/fpga-zynq&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;&lt;h3 dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;&lt;a aria-hidden=&quot;true&quot; class=&quot;anchor&quot; href=&quot;https://github.com/ucb-bar/fpga-zynq#-overview-of-system-stack&quot; id=&quot;user-content--overview-of-system-stack&quot; tabindex=&quot;-1&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; class=&quot;octicon octicon-link&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;/svg&gt;&lt;/a&gt;&lt;a name=&quot;user-content-overview&quot;&gt;&lt;/a&gt; Overview of System Stack&lt;/h3&gt;
&lt;p dir=&quot;auto&quot;&gt;Our system will allow you to run a RISC-V binary on a 
rocket core instantiated on a supported Zynq FPGA. This section will 
outline the stack of all of the parts involved and by proxy, outline the
 rest of the documentation. Going top-down from the RISC-V binary to the
 development system:&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;Target Application&lt;/strong&gt; (RISC-V binary)
will run on top of whatever kernel the rocket chip is running. Compiled by &lt;a href=&quot;https://github.com/riscv/riscv-gcc&quot;&gt;riscv-gcc&lt;/a&gt; or &lt;a href=&quot;https://github.com/riscv/riscv-llvm&quot;&gt;riscv-llvm&lt;/a&gt;.&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;RISC-V Kernel&lt;/strong&gt; (&lt;a href=&quot;https://github.com/riscv/riscv-pk&quot;&gt;proxy kernel&lt;/a&gt; or &lt;a href=&quot;https://github.com/riscv/riscv-linux&quot;&gt;RISC-V Linux&lt;/a&gt;)
runs on top of the rocket chip. The proxy kernel is extremely 
lightweight and designed to be used with a single binary linked against 
Newlib while RISC-V Linux is appropriate for everything else.&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;Rocket Chip&lt;/strong&gt; (&lt;a href=&quot;https://github.com/ucb-bar/rocket&quot;&gt;rocket core&lt;/a&gt;
 with L1 instruction and data caches)
is instantiated on the FPGA. Many of its structures will typically map 
to various hard blocks including BRAMs and DSP slices. It communicates 
to the host ARM core on the Zynq via AXI.&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;Front-end Server&lt;/strong&gt; (&lt;a href=&quot;https://github.com/riscv/riscv-fesvr&quot;&gt;riscv-fesvr&lt;/a&gt;)
runs on the host ARM core and provides an interface to the rocket chip running on the FPGA (connected via AXI).&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;Zynq ARM Core&lt;/strong&gt; (actually dual Cortex A9)
runs Linux and simplifies interfacing with the FPGA.&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;FPGA Board&lt;/strong&gt; (Zybo, Zedboard, or ZC706)
contains the Zynq FPGA and several I/O devices. At power on, the 
contents of the SD card are used to configure the FPGA and boot Linux on
 the ARM core.&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;External Communication&lt;/strong&gt; (TTY over serial on USB or telnet/ssh over ethernet)
allows the development system to communicate with the FPGA board.&lt;/p&gt;
&lt;p dir=&quot;auto&quot;&gt;&lt;strong&gt;Development System&lt;/strong&gt; (PC with SD card reader)
generates the images to configure the FPGA.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/1873124710608899697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1873124710608899697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1873124710608899697'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-ii.html' title='RISC-v on ZC706 Evaluation Board - Part II'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-5155456859109081152</id><published>2022-12-27T15:23:00.008-05:00</published><updated>2022-12-30T20:47:57.165-05:00</updated><title type='text'>RISC-v on ZC706 Evaluation Board - Part I</title><content type='html'>&lt;p&gt;Continue my journey with RISC-v on FPGA. This time, I got a &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=2ahUKEwjR9rCrrZP8AhVGEFkFHS4yDiMQFnoECA4QAQ&amp;amp;url=https%3A%2F%2Fwww.xilinx.com%2Fproducts%2Fboards-and-kits%2Fek-z7-zc706-g.html&amp;amp;usg=AOvVaw3buDY6QFCrU7ZZ22arm1gl&quot;&gt;Xilinx Zynq-7000 SoC ZC706 Evaluation kit&lt;/a&gt;. The board is at least 7 years old. The FPGA has two Cortex-a9 cores. And there is &lt;a href=&quot;https://github.com/ucb-bar/fpga-zynq&quot;&gt;https://github.com/ucb-bar/fpga-zynq&lt;/a&gt; which has everything needed to get RISC-v running on several Zynq FPGA boards, including ZC706. Again, this project has no update for more than four years now, so can foresee something might be out-of-date. Making this blog just for reference.&lt;/p&gt;&lt;p&gt;The fpga-zynq github repo has pretty good documentation. It&#39;s very easy to follow the Quick Instruction, just fetch images and load them to SD card. Setup the boot mode of the board, and all done. The only issue I had run into is related to the SD card. There are several links for FPGA boot from SD issue, like &lt;a href=&quot;https://support.xilinx.com/s/question/0D52E00006hpPfLSAU/sd-card-boot-problems-zc706-board&quot;&gt;https://support.xilinx.com/s/question/0D52E00006hpPfLSAU/sd-card-boot-problems-zc706-board&lt;/a&gt; and &lt;a href=&quot;https://support.xilinx.com/s/article/59476&quot;&gt;https://support.xilinx.com/s/article/59476&lt;/a&gt;. In general, need to make sure all needed files are properly copied to SD card. For my case, the SD card reader I used first has some weird issue. After I used a newer SD card reader, everything goes very smoothly.&lt;/p&gt;&lt;p&gt;For the 2nd step, pushing Rocket modification to FPGA, I got several problems.&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Problem 1: the instruction mentioned user can pick own rocket-chip directory by override &lt;code&gt;ROCKET_DIR&lt;/code&gt;. Since the freedom repo for Arty A7 contains rocket-chip repo, I was thinking to re-use that to reduce the time and disk usage. However, the &#39;make rocket&#39; command will run into this error:&lt;code class=&quot;notranslate&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;code class=&quot;notranslate&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;module not found: edu.berkeley.cs#chisel3_2.12;3.2-SNAPSHOT&lt;/code&gt;&lt;p&gt;The error is like &lt;a href=&quot;https://github.com/ucb-bar/chiseltest/issues/72&quot;&gt;https://github.com/ucb-bar/chiseltest/issues/72&lt;/a&gt; and &lt;a href=&quot;https://github.com/chipsalliance/chisel3/issues/518&quot;&gt;edu.berkeley.cs#chisel_2.11;3.1-SNAPSHOT: not found · Issue #518 · chipsalliance/chisel3 · GitHub&lt;/a&gt;. One post mentioned need to update the dependency from chisel2 to chisel3. I cannot figure out a quick way to get around this, so gave up on this. Instead, remove the setting of &lt;code&gt;ROCKET_DIR&lt;/code&gt;.&lt;code&gt; &#39;make init-submodules&#39; &lt;/code&gt;will download rocket_chip repo, and the not found of &lt;code class=&quot;notranslate&quot;&gt;edu.berkeley.cs:chisel3_2.12:3.3-SNAPSHOT &lt;/code&gt;is gone.&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Problem 2: &#39;&lt;code&gt;make rocket&#39; &lt;/code&gt;successfully created rocket_chip.stamp file, but reported no rule to make testchipip.stamp. This is a weird one, as the Makefile and common/Makefrag file does not have testchipip.stamp as target. Turns out due to the line-ending of generate-pkg-mk.sh file, the shell script failed to finish some work which leads to issue for EXTRA_PACKAGES=testchipip. One problem is the make command line doesn&#39;t generate meaningful message pointing to the shell script problem. I figured out that by turning on -d option for make, and run the script manually. For fixing this, do: &quot;git config --global core.autocrlf false&quot; then do git checkout to apply the setting.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Problem 3: Seeing error &lt;pre&gt;&lt;code&gt;Missing dependency &#39;object java.lang.Object in compiler mirror&#39;, 
required by /.m2/repository/org/scala-lang/scala-library/2.10.4/scala-library-2.10.4.jar(scala/package.class)
&lt;/code&gt;&lt;/pre&gt;JDK version not compatible with scala. As replied for &lt;a href=&quot;https://stackoverflow.com/questions/53942248/maven-error-missing-dependency-java-lang-object-required-by-scala&quot;&gt;https://stackoverflow.com/questions/53942248/maven-error-missing-dependency-java-lang-object-required-by-scala&lt;/a&gt;, each version of scala only works with certain version of JDK (refer to &lt;span class=&quot;comment-copy&quot;&gt;&lt;a href=&quot;https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs.scala-lang.org/overviews/jdk-compatibility/overview.html&lt;/a&gt;&lt;/span&gt;). For this case, have to stick with JDK8:&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;sudo apt install openjdk-8-jdk-headless&lt;br /&gt;sudo update-alternatives --install &quot;/usr/bin/java&quot; &quot;java&quot; &quot;/usr/lib/jvm/java-8-openjdk-amd64/bin/java&quot; 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;span class=&quot;token function&quot; face=&quot;ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;liberation mono&amp;quot;, &amp;quot;courier new&amp;quot;, monospace&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: #f8f9fa; box-sizing: border-box; color: #5c51e0; font-size: 14.4px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 500; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px;&quot;&gt;sudo&lt;/span&gt;&lt;span face=&quot;ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;liberation mono&amp;quot;, &amp;quot;courier new&amp;quot;, monospace&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: #f8f9fa; color: #1b1642; display: inline; float: none; font-size: 14.4px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px;&quot;&gt; update-alternatives --config java&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;div&gt;Problem 4: &quot;make project&quot; will need to invoke Vivado. On Windows, 
this can be achieved by running under Cygwin with Vivado executable 
added to PATH. However, on both Windows and Linux, I&#39;m seeing same error
 as:&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;ERROR:
 [Board 49-71] The board_part definition was not found for 
xilinx.com:zc706:part0:1.0. The project&#39;s board_part property was not 
set, but the project&#39;s part property was set to xc7z045ffg900-2. Valid 
board_part values can be retrieved with the &#39;get_board_parts&#39; Tcl 
command. Check if board.repoPaths parameter is set and the board_part is
 installed from the tcl app store&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Per &lt;a href=&quot;https://support.xilinx.com/s/question/0D52E00006hpjPlSAI/error-board-4971-the-boardpart-definition-was-not-found-for-xilinxcomzcu102part030-the-projects-boardpart-property-was-not-set-but-the-projects-part-property-was-set-to-xczu9egffvb1156?language=en_US&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;https://support.xilinx.com/s/question/0D52E00006lLBqpSAG/setting-board-file-fails-with-error-board-4971-the-boardpart-definition-was-not-found?language=en_US&quot;&gt;this &lt;/a&gt;and &lt;a href=&quot;https://github.com/sifive/freedom/issues/29&quot;&gt;this&lt;/a&gt;, as the instruction/repo is for Vivado 2016 but I&#39;m using 2022 version, would need to update the tcl script for creating Vivado project, modify the line like this:&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ol class=&quot;linenums&quot; style=&quot;-webkit-text-stroke-width: 0px; background: var(--lwc-colorBackgroundAlt,rgb(255, 255, 255)); border-bottom-right-radius: var(--lwc-borderRadiusMedium,0.25rem); border-top-right-radius: var(--lwc-borderRadiusMedium,0.25rem); box-sizing: border-box; color: #333333; counter-reset: linenumbers 0; font-family: monospace, monospace; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style: none; margin-bottom: 0px; margin-left: var(--lwc-listPadding,40px); margin-right: 0px; margin-top: 0px; padding-left: 0px; padding-right: 0px; position: relative; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px;&quot;&gt;&lt;li class=&quot;L0&quot; style=&quot;border-bottom-right-radius: var(--lwc-borderRadiusMedium,0.25rem); border-top-right-radius: var(--lwc-borderRadiusMedium,0.25rem); box-sizing: border-box; list-style: none; padding-bottom: var(--lwc-spacingXSmall,0.5rem); padding-top: var(--lwc-spacingXSmall,0.5rem);&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pln&quot; color=&quot;var(--lwc-codeSnippetColorBlack,#000000)&quot; style=&quot;box-sizing: border-box;&quot;&gt;set_property board_part xilinx&lt;/span&gt;&lt;span class=&quot;pun&quot; color=&quot;var(--lwc-codeSnippetColorBrown,#8F6D4D)&quot; style=&quot;box-sizing: border-box;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; color=&quot;var(--lwc-codeSnippetColorBlack,#000000)&quot; style=&quot;box-sizing: border-box;&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;pun&quot; color=&quot;var(--lwc-codeSnippetColorBrown,#8F6D4D)&quot; style=&quot;box-sizing: border-box;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; color=&quot;var(--lwc-codeSnippetColorBlack,#000000)&quot; style=&quot;box-sizing: border-box;&quot;&gt;zcu102&lt;/span&gt;&lt;span class=&quot;pun&quot; color=&quot;var(--lwc-codeSnippetColorBrown,#8F6D4D)&quot; style=&quot;box-sizing: border-box;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; color=&quot;var(--lwc-codeSnippetColorBlack,#000000)&quot; style=&quot;box-sizing: border-box;&quot;&gt;part0&lt;/span&gt;&lt;span class=&quot;pun&quot; color=&quot;var(--lwc-codeSnippetColorBrown,#8F6D4D)&quot; style=&quot;box-sizing: border-box;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; color=&quot;var(--lwc-codeSnippetColorGray,#5F6364)&quot; style=&quot;box-sizing: border-box;&quot;&gt;3.0&lt;/span&gt;&lt;span class=&quot;pln&quot; color=&quot;var(--lwc-codeSnippetColorBlack,#000000)&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; color=&quot;var(--lwc-codeSnippetColorBrown,#8F6D4D)&quot; style=&quot;box-sizing: border-box;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot; color=&quot;var(--lwc-codeSnippetColorBlack,#000000)&quot; style=&quot;box-sizing: border-box;&quot;&gt;current_project&lt;/span&gt;&lt;span class=&quot;pun&quot; color=&quot;var(--lwc-codeSnippetColorBrown,#8F6D4D)&quot; style=&quot;box-sizing: border-box;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;to:&lt;span class=&quot;uiOutputText&quot; dir=&quot;ltr&quot; face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #333333; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt; &lt;/span&gt;&lt;a class=&quot;cuf-url forceOutputURL&quot; data-value=&quot;https://xilinx.com&quot; href=&quot;https://xilinx.com/&quot; rel=&quot;noopener noreferrer&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: var(--lwc-brandTextLink,#2574A9); cursor: pointer; font-family: Roboto, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; transition: color 0.1s linear 0s; white-space: normal; widows: 2; word-spacing: 0px;&quot; target=&quot;_blank&quot; title=&quot;&quot;&gt;xilinx.com&lt;/a&gt;&lt;span class=&quot;uiOutputText&quot; dir=&quot;ltr&quot; face=&quot;Roboto, sans-serif&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #333333; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;:zcu102:part0:3.1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;For my case, would need to update zc706/src/tcl/zc706_rocketchip_ZynqFPGAConfig.tcl, which has line as: &lt;span style=&quot;font-family: courier;&quot;&gt;set_property &quot;board_part&quot; &quot;xilinx.com:zc706:part0:1.0&quot; $obj&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Run get_board_parts within the tcl console shows xilinx.com:zc706:part0:1.4. So update the tcl script, run &quot;rm -rf zc706_rocketchip_ZynqFPGAConfig&quot; first, then run &quot;make project&quot; again.&lt;/div&gt;&lt;div&gt;Then run into problem 5:&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;ERROR: [BD_TCL-109] This script was generated using Vivado &amp;lt;2016.2&amp;gt; and is being run in &amp;lt;2022.1&amp;gt; of Vivado. Please run the script in Vivado &amp;lt;2016.2&amp;gt; then open the design in Vivado &amp;lt;2022.1&amp;gt;. Upgrade the design by running &quot;Tools =&amp;gt; Report =&amp;gt; Report IP Status...&quot;, then run write_bd_tcl to create an updated script.&lt;/span&gt;&lt;br /&gt;This error is from zc706/src/tcl/zc706_bd.tcl. With 2022.1, &quot;Report&quot; is a separate menu item beside tools, and it only shows up after a project is opened. Really don&#39;t want to spend hours to install the 2016.2 version. So I just modified the zc706_bd.tcl to set the version as 2022.1 which matches the version I&#39;m using. With that, there is some critical warning, like this: &quot;&lt;i&gt;CRITICAL WARNING: [BD 41-737] Cannot set the parameter PCW_M_AXI_GP0_FREQMHZ on /processing_system7_0. It is read-only.&quot;, &lt;/i&gt;but
 the project (.xpr) file did get created successfully.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;Run &quot;make 
fpga-images-zc706/boot.bin&quot; will do synthesis and implementation with 
the project. This somehow not working for me, because of the bit file is
 missing. Likely this is due to my Vivado installation does not have valid license for creating bit for zynq. Opened the project from Vivado which has valid license, 
and generate bit file there. It got successfully generated on both Linux
 and Windows Vivado. However, when run &quot;make fpga-images-zc706/boot.bin&quot;
 again, the boot.bin would be successfully generated on Linux but not on
 Windows. Error for Windows/Cygwin run is like this:&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;ln
 -sf 
../../zc706_rocketchip_ZynqFPGAConfig/zc706_rocketchip_ZynqFPGAConfig.runs/impl_1/rocketchip_wrapper.bit
 fpga-images-zc706/boot_image/rocketchip_wrapper.bit&lt;br /&gt;cd fpga-images-zc706; bootgen -image boot.bif -w -o boot.bin&lt;br /&gt;...&lt;br /&gt;[ERROR]&amp;nbsp; : Cannot read BIT file - boot_image/rocketchip_wrapper.bit&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;The
 bit file under impl_1 did exist, however, &#39;ln -sf&#39; may create a 
junction point on NTFS, which might not work for Xilinx Windows bootgen.
 To get around this, delete the symbolic link, copy the bit file 
directly to fpga-images-zc706/boot_image folder, then CD to 
fpga-images-zc706 folder, and run &quot;bootgen -image boot.bif -w -o 
boot.bin&quot; directly (don&#39;t try the make command, as it will create the 
soft symbolic link again), and this works under Cygwin.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;So finally I got the binary built on both Linux and Windows/Cygwin.&amp;nbsp; Lesson learned is: for FPGA development, better do everything on Linux but not Windows: too many hassle.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At this point, I thought I had it completed, but in fact, it is not. So&amp;nbsp; &amp;lt;to be continue&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/5155456859109081152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/5155456859109081152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/5155456859109081152'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/12/risc-v-on-zc706-evaluation-board-part-i.html' title='RISC-v on ZC706 Evaluation Board - Part I'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-1665840679680447833</id><published>2022-12-01T18:01:00.004-05:00</published><updated>2022-12-01T19:48:25.576-05:00</updated><title type='text'>Program Arty A7 FPGA to be a RISC-V processor - Part IV</title><content type='html'>&lt;p class=&quot;mb-0 color-fg-muted&quot;&gt;&amp;nbsp;So still fighting with the &quot;&lt;span style=&quot;color: red;&quot;&gt;ERROR: [Synth 8-439] module &#39;BootROM&#39; not found&lt;/span&gt;&quot; issue. More internet search did bring back a clue from &lt;a href=&quot;https://github.com/sifive/freedom/issues/34&quot;&gt;https://github.com/sifive/freedom/issues/34&lt;/a&gt;,&lt;b class=&quot;css-truncate&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt; &lt;a class=&quot;author Link--primary text-bold css-truncate-target&quot; data-hovercard-type=&quot;user&quot; data-hovercard-url=&quot;/users/richardxia/hovercard&quot; data-octo-click=&quot;hovercard-link-click&quot; data-octo-dimensions=&quot;link_type:self&quot; href=&quot;https://github.com/richardxia&quot;&gt;richardxia&lt;/a&gt;
  

    &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;

    

    commented


      &lt;a class=&quot;Link--secondary js-timestamp&quot; href=&quot;https://github.com/sifive/freedom/issues/34#issuecomment-332598567&quot; id=&quot;issuecomment-332598567-permalink&quot;&gt;Sep 27, 2017&lt;/a&gt;: &lt;i&gt;BootROM uses Chisel&#39;s sequential memory feature, so it does not refer to an existing Verilog module. You will need to use the &lt;code class=&quot;notranslate&quot;&gt;vlsi_rom_gen&lt;/code&gt; script from rocket-chip to generate the Verilog file from the ROM parameters. See our Makefile rule for handling this:&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt; &lt;a href=&quot;https://github.com/sifive/freedom/blob/22ee433699dca058f96858c15e7a2b0c33547d63/bootrom/xip/Makefile#L38&quot;&gt;freedom/bootrom/xip/Makefile&lt;/a&gt;, Line 38
      in
      &lt;a class=&quot;commit-tease-sha&quot; data-pjax=&quot;true&quot; href=&quot;https://github.com/sifive/freedom/commit/22ee433699dca058f96858c15e7a2b0c33547d63&quot;&gt;22ee433&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;: $(&lt;span class=&quot;pl-smi&quot;&gt;rocketchip_dir&lt;/span&gt;)&lt;/span&gt;/scripts/vlsi_rom_gen &lt;span class=&quot;pl-s&quot;&gt;$(&lt;span class=&quot;pl-smi&quot;&gt;ROMCONF&lt;/span&gt;)&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;$&amp;lt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;$@&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class=&quot;mb-0 color-fg-muted&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;But, it didn&#39;t explain how this is invoked during the build. In the Makefile it has a line as:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;mb-0 color-fg-muted&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;&amp;nbsp;export BOOTROM_DIR := $(base_dir)/bootrom/xip&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;mb-0 color-fg-muted&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;In common.mk, target &#39;romgen&#39; would run make under $BOOTROM_DIR, and target &#39;bit&#39; is depends on &#39;romgen&#39;, and target &#39;mcs&#39; is depends on &#39;bit&#39;. So it should be built while run &lt;span style=&quot;color: #2b00fe;&quot;&gt;make ... mcs&lt;/span&gt;. So I did a clean build with log captured, and found build error as:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;mb-0 color-fg-muted&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;java -Xmx2G -Xss8M -XX:MaxPermSize=256M -cp /mnt/ext4/freedom/rocket-chip/firrtl/utils/bin/firrtl.jar firrtl.Driver -i /mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.fir -o /mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.v -X verilog&lt;br /&gt;OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0&lt;br /&gt;Total FIRRTL Compile Time: 55117.1 ms&lt;br /&gt;make -C /mnt/ext4/freedom/bootrom/xip romgen&lt;br /&gt;make[1]: Entering directory &#39;/mnt/ext4/freedom/bootrom/xip&#39;&lt;br /&gt;dtc -I dts -O dtb -o /mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.dtb /mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.dts&lt;br /&gt;/mnt/ext4/riscv/bin/riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -O2 -std=gnu11 -Wall -I. -nostartfiles -fno-common -g -DXIP_TARGET_ADDR=0x20400000 -DDEVICE_TREE=&#39;&quot;/mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.dtb&quot;&#39; -static -nostdlib -o /mnt/ext4/freedom/builds/e300artydevkit/xip.elf xip.S&lt;br /&gt;/mnt/ext4/riscv/bin/riscv64-unknown-elf-objcopy -O binary /mnt/ext4/freedom/builds/e300artydevkit/xip.elf /mnt/ext4/freedom/builds/e300artydevkit/xip.bin&lt;br /&gt;od -t x4 -An -w4 -v /mnt/ext4/freedom/builds/e300artydevkit/xip.bin &amp;gt; /mnt/ext4/freedom/builds/e300artydevkit/xip.hex&lt;br /&gt;/mnt/ext4/freedom/rocket-chip/scripts/vlsi_rom_gen /mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.rom.conf /mnt/ext4/freedom/builds/e300artydevkit/xip.hex &amp;gt; /mnt/ext4/freedom/builds/e300artydevkit/rom.v&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;Traceback (most recent call last):&lt;br /&gt;&amp;nbsp; File &quot;/mnt/ext4/freedom/rocket-chip/scripts/vlsi_rom_gen&quot;, line 90, in iterate_by_n&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; batch += (next(it),)&lt;br /&gt;StopIteration&lt;br /&gt;&lt;br /&gt;The above exception was the direct cause of the following exception:&lt;br /&gt;&lt;br /&gt;Traceback (most recent call last):&lt;br /&gt;&amp;nbsp; File &quot;/mnt/ext4/freedom/rocket-chip/scripts/vlsi_rom_gen&quot;, line 138, in &amp;lt;module&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;br /&gt;&amp;nbsp; File &quot;/mnt/ext4/freedom/rocket-chip/scripts/vlsi_rom_gen&quot;, line 134, in main&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; **parse_line(line))&lt;br /&gt;&amp;nbsp; File &quot;/mnt/ext4/freedom/rocket-chip/scripts/vlsi_rom_gen&quot;, line 113, in parse_line&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kwargs = {key: try_cast_int(val)&lt;br /&gt;&amp;nbsp; File &quot;/mnt/ext4/freedom/rocket-chip/scripts/vlsi_rom_gen&quot;, line 113, in &amp;lt;dictcomp&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kwargs = {key: try_cast_int(val)&lt;br /&gt;RuntimeError: generator raised StopIteration&lt;br /&gt;make[1]: *** [Makefile:38: /mnt/ext4/freedom/builds/e300artydevkit/rom.v] Error 1&lt;/span&gt;&lt;br /&gt;make[1]: Leaving directory &#39;/mnt/ext4/freedom/bootrom/xip&#39;&lt;br /&gt;make: *** [common.mk:68: /mnt/ext4/freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.rom.v] Error 2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;mb-0 color-fg-muted&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;And if re-run the make command, the error would be hidden, might because of rom.v file was already generated, even it was error out for previous make run. To fix that, as mentioned &lt;a href=&quot;https://github.com/chipsalliance/rocket-chip/issues/1991&quot;&gt;https://github.com/chipsalliance/rocket-chip/issues/1991&lt;/a&gt;, need to update &lt;span style=&quot;color: #38761d;&quot;&gt;rocket-chip/scripts/vlsi_rom_gen&lt;/span&gt; line 97, replace &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;raise&lt;/span&gt;&#39; with &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;return&lt;/span&gt;&#39;, then re-do a &lt;u&gt;clean build&lt;/u&gt;. Eventually now it is moving forward. And &lt;span style=&quot;color: #2b00fe;&quot;&gt;make .. mcs&lt;/span&gt; will have the bit file generated. The bit file was generated under &lt;span style=&quot;color: #38761d;&quot;&gt;builds/e300artydevkit/obj/&lt;/span&gt; folder. And Vivado project file is also available under &lt;span style=&quot;color: #38761d;&quot;&gt;builds/e300artydevkit&lt;/span&gt;, as &lt;span style=&quot;color: #38761d;&quot;&gt;E300ArtyDevKitFPGAChip.xpr&lt;/span&gt;. It can be opened with Vivado, to view all the settings.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/1665840679680447833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/12/program-arty-a7-fpga-to-be-risc-v.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1665840679680447833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1665840679680447833'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/12/program-arty-a7-fpga-to-be-risc-v.html' title='Program Arty A7 FPGA to be a RISC-V processor - Part IV'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-6764841880991993650</id><published>2022-11-23T15:25:00.008-05:00</published><updated>2022-12-01T17:39:43.833-05:00</updated><title type='text'>Program Arty A7 FPGA to be a RISC-V processor - Part III</title><content type='html'>&lt;p&gt;&amp;nbsp;Since having lot of problem to follow &lt;a href=&quot;https://digilent.com/reference/programmable-logic/arty-a7/reference-manual&quot;&gt;https://digilent.com/reference/programmable-logic/arty-a7/reference-manual&lt;/a&gt; instruction on Windows/WSL/Cygwin, so I moved to do that on Linux/Ubuntu. Most thing goes smoothly. Do need to update several .gitmodules file to get everything synced, i.e. replace git://github.com to https://github.com.&lt;/p&gt;&lt;p&gt;When start to build the toolchain, I hit the first problem is while building riscv-openocd:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;Multiple definitions of bitbang_swd originating from jtag/drivers/bitbang.h&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Per &lt;a href=&quot;https://github.com/riscv/riscv-openocd/issues/480&quot;&gt;https://github.com/riscv/riscv-openocd/issues/480&lt;/a&gt;, this likely is due to newer GCC 10+ which defaulting to -fno-common. I&#39;m using GCC 11.3.0. So just as suggested, add the &#39;extern&#39; keyword in front of the const swd_driver struct in bitbang.h.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Then hit this one for compiling riscv-fesvr ../fesvr/dtm.cc:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;runtime_error&#39; is not a member of std&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;According to &lt;a href=&quot;https://github.com/Azure/azure-storage-fuse/issues/421&quot;&gt;https://github.com/Azure/azure-storage-fuse/issues/421&lt;/a&gt;, it may relate to g++ version: According to &lt;a href=&quot;https://en.cppreference.com/w/cpp/error/runtime_error&quot; rel=&quot;nofollow&quot;&gt;https://en.cppreference.com/w/cpp/error/runtime_error&lt;/a&gt;, the include should not be &lt;code class=&quot;notranslate&quot;&gt;exception.h&lt;/code&gt; but &lt;code class=&quot;notranslate&quot;&gt;&amp;lt;stdexcept&amp;gt;.&lt;/code&gt; So the fix is adding &lt;span style=&quot;color: #2b00fe;&quot;&gt;#include &amp;lt;stdexcept&amp;gt;&lt;/span&gt; to dtm.cc.&lt;/p&gt;&lt;p&gt;Similar need to be done for riscv-isa-sim/riscv/devices.h.&lt;/p&gt;&lt;p&gt;With that, the toolchain build is OK. And make for verilog is done without any issue. However, when run &lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;make -f Makefile.e300artydevkit mcs&lt;/pre&gt;&lt;p&gt;Seeing this: &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;ERROR: [Synth 8-439] module &#39;BootROM&#39; not found [/path_of_freedom/builds/e300artydevkit/sifive.freedom.everywhere.e300artydevkit.E300ArtyDevKitConfig.v:242627]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/sifive/freedom/issues/96&quot;&gt;Make -f Makefile.e300artydevkit mcs fails - module BootRom not found · Issue #96 · sifive/freedom · GitHub&lt;/a&gt; someone says re-sync repo solved the problem for him. My Vivado is 2022.1 build, and Digilent&#39;s instruction is using 2017 build. Hopefully the new version Vivado is not the problem.&lt;/p&gt;&lt;p&gt;By looking into the make log (there is log file under builds folder), the BootROM module is referenced in the .v file, which is coming from the .fir file as &#39;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;extmodule BootROM&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&#39;. So likely a dependency is missing.&lt;/p&gt;&lt;p&gt;Then I went back to check files in the repo, and noticed in the root README.md, it mentioned two things:&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;As of March 1 2021, SiFive is archiving the freedom repository. The code here &lt;u&gt;is not being actively maintained&lt;/u&gt;, and we can&#39;t continue to provide updates while the fpga boards, software ecosystems and other dependencies change. &lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Install &lt;span style=&quot;color: #2b00fe;&quot;&gt;sbt&lt;/span&gt;, &lt;span style=&quot;color: #2b00fe;&quot;&gt;varilator &lt;/span&gt;(probably typo of verilator) and &lt;span style=&quot;color: #2b00fe;&quot;&gt;scala &lt;/span&gt;which are required for building from &lt;span style=&quot;color: #2b00fe;&quot;&gt;Chisel&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Per &lt;a href=&quot;https://www.chisel-lang.org/&quot;&gt;https://www.chisel-lang.org/&lt;/a&gt;: The &lt;b&gt;Constructing Hardware in a Scala Embedded Language&lt;/b&gt; (&lt;a href=&quot;https://www.chisel-lang.org&quot;&gt;&lt;b&gt;Chisel&lt;/b&gt;&lt;/a&gt;)
 is an open-source hardware description language (HDL) used to describe 
digital electronics and circuits at the register-transfer level that 
facilitates &lt;b&gt;advanced circuit generation and design reuse for both ASIC and FPGA digital logic designs&lt;/b&gt;. Chisel is powered by &lt;a href=&quot;https://github.com/chipsalliance/firrtl&quot;&gt;FIRRTL (Flexible Intermediate Representation for RTL)&lt;/a&gt;,
 a hardware compiler framework that performs optimizations of 
Chisel-generated circuits and supports custom user-defined circuit 
transformations.&lt;/p&gt;&lt;p&gt;&lt;b&gt;sbt &lt;/b&gt;home site: &lt;a href=&quot;https://www.scala-sbt.org/&quot;&gt;https://www.scala-sbt.org/&lt;/a&gt;. Per &lt;a href=&quot;https://en.wikipedia.org/wiki/Sbt_(software)&quot;&gt;Wikipedia&lt;/a&gt;: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;sbt&lt;/b&gt; is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Open-source_software&quot; title=&quot;Open-source software&quot;&gt;open-source&lt;/a&gt; &lt;a class=&quot;mw-redirect&quot; href=&quot;https://en.wikipedia.org/wiki/Build_tool&quot; title=&quot;Build tool&quot;&gt;build tool&lt;/a&gt; for &lt;a href=&quot;https://en.wikipedia.org/wiki/Scala_(programming_language)&quot; title=&quot;Scala (programming language)&quot;&gt;Scala&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Java_(programming_language)&quot; title=&quot;Java (programming language)&quot;&gt;Java&lt;/a&gt; projects, similar to &lt;a class=&quot;mw-redirect&quot; href=&quot;https://en.wikipedia.org/wiki/Apache_Software_Foundation&quot; title=&quot;Apache Software Foundation&quot;&gt;Apache&#39;s&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Apache_Maven&quot; title=&quot;Apache Maven&quot;&gt;Maven&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Gradle&quot; title=&quot;Gradle&quot;&gt;Gradle&lt;/a&gt;.
&lt;/p&gt;&lt;p&gt;And the keyword extmodule is from &lt;b&gt;Chisel&lt;/b&gt;. So likely, would need to install them as the README said. The instruction for installing sbt might need to be updated as it doesn&#39;t work with new Ubuntu. Refer to &lt;a href=&quot;https://www.scala-sbt.org/download.html&quot;&gt;https://www.scala-sbt.org/download.html&lt;/a&gt;. Not sure why the README.md specified verilator_3_922. Ubuntu has this package, so I run &lt;span style=&quot;color: #2b00fe;&quot;&gt;sudo apt install verilator&lt;/span&gt; directly, same for scala.&lt;/p&gt;&lt;p&gt;With that, now running make mcs will ask for python. I installed &lt;span style=&quot;color: #2b00fe;&quot;&gt;python-is-python3&lt;/span&gt; package, and now seeing a new error, same as described as &lt;a href=&quot;https://github.com/chipsalliance/rocket-chip/issues/1991&quot;&gt;https://github.com/chipsalliance/rocket-chip/issues/1991&lt;/a&gt;:&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;notranslate&quot;&gt;&lt;code&gt;Traceback (most recent call last):
  File &quot;rocket-chip/scripts/vlsi_rom_gen&quot;, line 90, in iterate_by_n
    batch += (next(it),)
StopIteration&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;As the ticket said, most likely due to I had Python3 but not Python (2.7) installed. Interestingly, the problem is gone after 2nd run of make, and then back to the no BootROM module issue.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Will chasing down the cause. &amp;lt;to be continue&amp;gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/6764841880991993650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/11/program-arty-a7-fpga-to-be-risc-v_23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/6764841880991993650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/6764841880991993650'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/11/program-arty-a7-fpga-to-be-risc-v_23.html' title='Program Arty A7 FPGA to be a RISC-V processor - Part III'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-7711645452427683055</id><published>2022-11-23T11:37:00.004-05:00</published><updated>2022-11-23T11:37:29.356-05:00</updated><title type='text'>Program Arty A7 FPGA to be a RISC-V processor - Part II</title><content type='html'>&lt;p&gt;&amp;nbsp;When I started on this journey by following instruction from &lt;a href=&quot;https://digilent.com/reference/programmable-logic/arty-a7/start&quot;&gt;https://digilent.com/reference/programmable-logic/arty-a7/start&lt;/a&gt;, I installed Xilinx Vivado on Windows PC as that is the primary working environment. Then when I started building RISC-v, I realized the instruction is all Linux oriented, so I decided to use WSL2 environment to build. The toolchain was successfully built. &quot;make -f Makefile.e300artydevkit verilog&quot; is also OK. But running into problem with &quot;make -f Makefile.e300artydevkit mcs&quot; runs into problem, as it needs to invoke vivado, which I haven&#39;t installed, and do not plan to install it under WSL2, simply because it takes too much disk space, and I&#39;m not sure the sure the GUI would work well under WSL2.&lt;/p&gt;&lt;p&gt;Farther looking into the print out from the make mcs output, turns out it is running this from common.mk:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;bit := $(BUILD_DIR)/obj/$(MODEL).bit&lt;br /&gt;$(bit): $(romgen) $(f)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cd $(BUILD_DIR); vivado \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -nojournal -mode batch \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -source $(fpga_common_script_dir)/vivado.tcl \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -tclargs \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -top-module &quot;$(MODEL)&quot; \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -F &quot;$(f)&quot; \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -ip-vivado-tcls &quot;$(shell find &#39;$(BUILD_DIR)&#39; -name &#39;*.vivado.tcl&#39;)&quot; \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -board &quot;$(BOARD)&quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Build .mcs&lt;br /&gt;mcs := $(BUILD_DIR)/obj/$(MODEL).mcs&lt;br /&gt;$(mcs): $(bit)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cd $(BUILD_DIR); vivado -nojournal -mode batch -source $(fpga_common_script_dir)/write_cfgmem.tcl -tclargs $(BOARD) $@ $&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;So it is possible to utilize the Vivado Windows installation, either still do the make under WSL2, or run the make with GNU shell under Windows (such as Cygwin).&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Approach A&lt;/b&gt;: Run make under WSL2, install missing Vivado Linux executable&lt;/p&gt;&lt;p&gt;For Windows Vivado installation, it also include Linux vivado shell script under the bin folder. So would need to add the path to the bin like below: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;export PATH=$PATH:/mnt/c/Xilinx/Vivado/2022.1/bin&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;However, Windows Vivado installation won&#39;t have Linux executable installed. Would see error like:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;WARNING: /mnt/c/Xilinx/Vivado/2022.1/tps/lnx64/jre11.0.11_9 does not exist.&lt;br /&gt;ERROR: Could not find 64-bit executable.&lt;br /&gt;ERROR: /mnt/c/Xilinx/Vivado/2022.1/bin/unwrapped/lnx64.o/vivado does not exist&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;So would need to extract these missing binaries from installation package.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Approach B&lt;/b&gt;: Run make using Cygwin&lt;/p&gt;&lt;p&gt;My freedom.git was synced to my WSL2 home folder. So first thing is find out the Windows path to it. Information can be found from &lt;a href=&quot;https://superuser.com/questions/1185033/what-is-the-home-directory-on-windows-subsystem-for-linux&quot;&gt;https://superuser.com/questions/1185033/what-is-the-home-directory-on-windows-subsystem-for-linux&lt;/a&gt;. For my WSL2 installed on Windows 11, under&lt;code&gt; %LOCALAPPDATA%\Packages\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState&lt;/code&gt; is only a &#39;ext4.vhdx&#39; file, which likely is a virtual disk file. So the way to access it from Cygwin would be map it as a driver, with command like this: net use U: \\wsl.localhost\Ubuntu&lt;/p&gt;&lt;p&gt;Then from Cygwin, cd U: should change CWD to the root dir of WSL2 Ubuntu. However, the make command might still fail with error like this:&lt;/p&gt;&lt;p&gt;Sourcing tcl script &#39;C:/Users/$win_user/AppData/Roaming/Xilinx/Vivado/Vivado_init.tcl&#39;&lt;br /&gt;source /cygdrive/u/home/$wsl_user/freedom/fpga-shells/xilinx/common/tcl/vivado.tcl&lt;br /&gt;couldn&#39;t read file &quot;/cygdrive/u/home/$wsl_user/freedom/fpga-shells/xilinx/common/tcl/vivado.tcl&quot;: no such file or directory&lt;/p&gt;&lt;p&gt;To get around this, I moved the freedom folder to be under /mnt/c, which is the Windows C: drive. And this time, it gave me a new error when running make under Cygwin:&lt;/p&gt;&lt;p&gt;Cannot find a jar file even the file exist. So for now, give up on this, until later have some time. Probably can do that directly from Vivado?&lt;/p&gt;&lt;p&gt;&amp;lt;to be continue: moving to do that on Linux&amp;gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/7711645452427683055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/11/program-arty-a7-fpga-to-be-risc-v.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/7711645452427683055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/7711645452427683055'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/11/program-arty-a7-fpga-to-be-risc-v.html' title='Program Arty A7 FPGA to be a RISC-V processor - Part II'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-3876175450865708727</id><published>2022-10-19T23:18:00.020-04:00</published><updated>2022-11-25T21:28:46.574-05:00</updated><title type='text'>Program Arty A7 FPGA to be a RISC-V processor - Part I</title><content type='html'>&lt;p&gt;&amp;nbsp;This is a note for things encounter while following instruction to program a Digilent Arty A7 board as RISC-V core. As &lt;a href=&quot;https://digilent.com/reference/programmable-logic/arty-a7/reference-manual&quot;&gt;https://digilent.com/reference/programmable-logic/arty-a7/reference-manual&lt;/a&gt; described: &lt;span style=&quot;color: #444444;&quot;&gt;&lt;i&gt;The Arty A7, formerly known as the Arty, is a ready-to-use development 
platform designed around the Artix-7™ Field Programmable Gate Array 
(FPGA) from Xilinx&lt;/i&gt;&lt;/span&gt;.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://digilent.com/reference/programmable-logic/arty-a7/start&quot;&gt;https://digilent.com/reference/programmable-logic/arty-a7/start&lt;/a&gt; has tutorials &lt;a class=&quot;wikilink1&quot; href=&quot;https://digilent.com/reference/programmable-logic/guides/installing-vivado-and-vitis&quot; title=&quot;programmable-logic:guides:installing-vivado-and-vitis&quot;&gt;Installing Vivado, Vitis, and Digilent Board Files&lt;/a&gt; and &lt;a class=&quot;wikilink1&quot; href=&quot;https://digilent.com/reference/programmable-logic/arty-a7/arty_a7_100_risc_v/start&quot; title=&quot;programmable-logic:arty-a7:arty_a7_100_risc_v:start&quot;&gt;Running a RISC-V Processor on the Arty A7&lt;/a&gt;. The first link has instruction for how to install software/files for the FPGA development. The second link is for how to program Arty A7 as RISC-v core.&lt;/p&gt;&lt;p&gt;For installing Vivado/Vitis, software package is huge. &lt;a href=&quot;https://www.xilinx.com/support/download.html&quot;&gt;Xilinx download page&lt;/a&gt; recommends to use the web installer. However, people like me was hitting &lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;&quot;Peer not authenticated&quot; issue as mentioned &lt;a href=&quot;https://support.xilinx.com/s/question/0D52E00006sAX7iSAG/solved-problem-during-install-peer-not-authenticated?language=en_US&quot;&gt;here&lt;/a&gt;. The solution is download the &lt;/span&gt;&lt;span class=&quot;fas fa-download&quot;&gt;&lt;/span&gt;
                  &lt;a data-original-title=&quot;Xilinx Unified Installer 2022.1 SFD&quot; data-toggle=&quot;tooltip&quot; href=&quot;https://www.xilinx.com/member/forms/download/xef.html?filename=Xilinx_Unified_2022.1_0420_0327.tar.gz&quot;&gt;Xilinx Unified Installer 2022.1 SFD&lt;/a&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt; gzip file, extract and install. The gzip file is 73.8G, download and extract would need a lot of hard disk space. At least, it works.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;For programming Arty A7 as RISC-V, I&#39;m getting many trouble. First, download SiFive Freedom processor with git command:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;git clone --recursive https://github.com/sifive/freedom.git&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;this would take quite some time to download the git plus a bunch of sub-modules. And may fail with some sub-modules as there are so many of them, and either there is network issue, or the repo server URL was change. If the clone isn&#39;t success, then have to fix that, otherwise, won&#39;t be able to build. To sync missing sub-module, refer to &lt;/span&gt;&lt;a href=&quot;https://git-scm.com/book/en/v2/Git-Tools-Submodules&quot;&gt;Git - Submodules (git-scm.com)&lt;/a&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt; May run:&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;highlight&quot; style=&quot;-webkit-text-stroke-width: 0px; background: rgb(238, 238, 238); border-radius: 3px; border: 1px solid rgb(239, 238, 230); box-sizing: border-box; color: #333333; display: block; font-family: monospace; font-size: 0.9em; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 15.12px; margin: 10px 0px; orphans: 2; overflow: auto; padding: 2px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot; style=&quot;background: rgb(238, 238, 238); border-radius: 3px; border: 0px none; box-sizing: border-box; color: #333333; display: inline; font-family: monospace; font-size: 1em; line-height: 18px; margin-bottom: 1em; overflow: auto; padding: 0px;&quot;&gt;# copy the new URL to your local config
$ &lt;span style=&quot;color: #2b00fe;&quot;&gt;git submodule sync --recursive&lt;/span&gt;
# update the submodule from the new URL
$ &lt;span style=&quot;color: #2b00fe;&quot;&gt;git submodule update --init --recursive&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;If seeing not empty warning, might need to clean those sub-folder first.&lt;/span&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt; Might see different problem like:&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: red;&quot;&gt;Submodule &#39;env&#39; (git://github.com/ucb-bar/riscv-test-env.git) registered for path &#39;rocket-chip/torture/env&#39;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;color: red;&quot;&gt;Cloning into &#39;/home/$user/freedom/rocket-chip/torture/env&#39;...&lt;br /&gt;fatal: unable to connect to github.com:&lt;br /&gt;github.com[0: 140.82.114.3]: errno=Connection timed out&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;cd to &lt;/span&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;freedom/rocket-chip/torture &lt;/span&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;and check the &#39;.gitmodules&#39; would get:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;cat .gitmodules&lt;br /&gt;[submodule &quot;env&quot;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = env&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = git://github.com/ucb-bar/riscv-test-env.git&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;Per this &lt;a href=&quot;https://github.com/ucb-bar/riscv-sodor/issues/8&quot;&gt;post&lt;/a&gt;, either need to make sure to have SSH key setup, or use https instead of SSH protocol for the git url. So manually run: &lt;span style=&quot;color: #2b00fe;&quot;&gt;git clone https:&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;//github.com/ucb-bar/riscv-test-env.git env&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;Or run this to update the .gitmodules file:&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;notranslate&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;code&gt;sed s#git://github.com#https://github.com#g -i .gitmodules
git submodule sync&lt;/code&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;For problem like: &quot;&lt;span style=&quot;color: red;&quot;&gt;server certificate verification failed. CAfile: none CRLfile: none&lt;/span&gt;&quot;, try this as mentioned in this &lt;a href=&quot;https://stackoverflow.com/questions/21181231/server-certificate-verification-failed-cafile-etc-ssl-certs-ca-certificates-c&quot;&gt;stackoverflow post&lt;/a&gt;: &lt;/span&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;&lt;span class=&quot;comment-copy&quot;&gt;&lt;code&gt;sudo apt update ; sudo apt-get install apt-transport-https ca-certificates -y ; sudo update-ca-certificates&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;Once git sync is OK, the first step is building the toolchain. &lt;/span&gt;Change working directory to &lt;span style=&quot;color: #04ff00;&quot;&gt;rocket-chip/riscv-tools&lt;/span&gt;, and check &lt;span style=&quot;color: #04ff00;&quot;&gt;README.md&lt;/span&gt; there: &lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;would need to set RISCV environment variable first, like this:&amp;nbsp; &lt;span style=&quot;color: #2b00fe;&quot;&gt;export RISCV=/mnt/c/develop/riscv&lt;/span&gt;, also, several packages are needed for building the toolchain. R&lt;/span&gt;un the &lt;span style=&quot;color: #04ff00;&quot;&gt;build.sh&lt;/span&gt; script to build, and it will&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt; take some time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;Next step is building Verilog installation. Please note the instruction &lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: #2b00fe;&quot;&gt;make -f Makefile.e300artydevkit &lt;span style=&quot;color: red;&quot;&gt;V&lt;/span&gt;erilog&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;should have the target &#39;Verilog&#39; as all little case &#39;&lt;span style=&quot;color: #2b00fe;&quot;&gt;verilog&lt;/span&gt;&#39; (which is in common.mk). There is several other cases in the Digilent instruction which should use all little case as well, such as Xilinx=&amp;gt;xilinx&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;uiOutputText&quot; data-aura-class=&quot;uiOutputText&quot; data-aura-rendered-by=&quot;27:183;a&quot;&gt;&amp;lt; to be continue &amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/3876175450865708727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/10/program-arty-a7-fpga-to-be-risc-v.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3876175450865708727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/3876175450865708727'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/10/program-arty-a7-fpga-to-be-risc-v.html' title='Program Arty A7 FPGA to be a RISC-V processor - Part I'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-1015665527528018894</id><published>2022-09-21T22:03:00.003-04:00</published><updated>2022-10-23T00:19:58.280-04:00</updated><title type='text'>Install multiple Ubuntu instances in WSL2</title><content type='html'>&lt;p&gt;&amp;nbsp;Yes, there are probably many post about this, such as &lt;a href=&quot;https://cloudbytes.dev/snippets/how-to-install-multiple-instances-of-ubuntu-in-wsl2&quot;&gt;https://cloudbytes.dev/snippets/how-to-install-multiple-instances-of-ubuntu-in-wsl2&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/51584765/how-do-you-install-multiple-separate-instances-of-ubuntu-in-wsl&quot;&gt;https://stackoverflow.com/questions/51584765/how-do-you-install-multiple-separate-instances-of-ubuntu-in-wsl&lt;/a&gt;. Still want to make this post about a special case not covered anywhere else.&lt;/p&gt;&lt;p&gt;Run wsl -l can show all installed distribution. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;If want to remove one of the distribution, run: &lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: #eff1f2; color: #3e3e3e; display: inline !important; float: none; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;wsl --unregister &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: red; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;&amp;lt;DistributionName&amp;gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;Recently I&#39;m playing with ROS Kinetic. Unfortunately, as mentioned &lt;a href=&quot;http://wiki.ros.org/kinetic/Installation/Ubuntu&quot;&gt;http://wiki.ros.org/kinetic/Installation/Ubuntu&lt;/a&gt;, only old Wily (15.10) and Xenial (16.04 LTS) are supported. It&#39;s possible to get it setup with VirtualBox or VMware VM, but I&#39;d like to go with WSL2 on Windows 11, as mentioned in my the &lt;a href=&quot;https://dencode.blogspot.com/2020/06/windows10-ubuntu-wsl2.html&quot; target=&quot;_blank&quot;&gt;other post&lt;/a&gt;, it is possible to enable Ubuntu GUI with the Windows 11 build 22000+. One problem here is the Xenial Ubuntu is no longer available from Microsoft Store, so would need to use WSL2 very useful &#39;import&#39; feature. For this, would need a tar.gz file of the Ubuntu distribution, the ISO image file doesn&#39;t work with WSL import. Another problem now, seems there is no tar for the Xenial Desktop image, but the base image is available such as the amd64 one as &lt;a href=&quot;https://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.6-base-amd64.tar.gz&quot;&gt;ubuntu-base-16.04.6-base-amd64.tar.gz&lt;/a&gt;, and it is pretty small, just 41MB. Using command like this to import it:&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;ct-span oxy-stock-content-styles&quot; id=&quot;span-87-157&quot;&gt;&lt;pre class=&quot;wp-block-code&quot;&gt;wsl --import xenial c:\Users\%USERNAME%\wsl_xenial .\Downloads\ubuntu-base-16.04.6-base-amd64.tar.gz&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;(Note: for imported distro, if run wsl --unregister, it will delete distro file). There is no Ubuntu desktop and only user root is created. To add new user, run following command with the root account to add the user and add it to sudo group:&lt;p&gt;&lt;span class=&quot;ct-span oxy-stock-content-styles&quot; id=&quot;span-87-157&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;adduser newuser&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;ct-span oxy-stock-content-styles&quot; id=&quot;span-87-157&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;usermod -aG sudo newuser&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Try this to verify the user group and switch to it:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;ct-span oxy-stock-content-styles&quot; id=&quot;span-87-157&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;groups newuser&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;su - newuser&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Type &#39;exit&#39; to switch back to root, and run &#39;apt update&#39; and &#39;apt install sudo&#39;, so later the new user can do apt install with sudo command. This is the minimum for installing other package as new user.&amp;nbsp;&lt;/p&gt;&lt;p&gt;To get the desktop environment, run: &#39;sudo apt install ubuntu-desktop&#39;, which installs most common packages. On WSL/Windows OS side, need to follow &lt;a href=&quot;https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps&quot;&gt;https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps&lt;/a&gt;, installing the AMD/nVidia/Intel&#39;s Virtual GPU (vGPU) driver first, then run: &#39;wsl --update&#39; and &#39;wsl --shutdown&#39; for a clean restart. May install gedit and run it to verify the GUI. Per my testing, with Ubuntu 20.04 LTS the GUI works fine. However, doesn&#39;t work for Ubuntu 16.04 Xenial, seeing segment fault and probably core dump. Tried &lt;a data-linktype=&quot;external&quot; href=&quot;https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg&quot;&gt;Diagnosing &quot;cannot open display&quot; type issues with WSLg&lt;/a&gt; but not much luck. So leave it aside for now.&lt;br /&gt;&lt;/p&gt;&lt;span class=&quot;ct-span oxy-stock-content-styles&quot; id=&quot;span-87-157&quot;&gt;&lt;/span&gt;&lt;span class=&quot;ct-span oxy-stock-content-styles&quot; id=&quot;span-87-157&quot;&gt;&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/1015665527528018894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/09/install-multiple-ubuntu-instances-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1015665527528018894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1015665527528018894'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/09/install-multiple-ubuntu-instances-in.html' title='Install multiple Ubuntu instances in WSL2'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4725034836547244528.post-1850833846581165431</id><published>2022-07-10T16:36:00.006-04:00</published><updated>2022-12-01T18:17:57.383-05:00</updated><title type='text'>我的小鸡们</title><content type='html'>&lt;p&gt;&lt;br /&gt;&amp;nbsp;六月18日星期周六，对我们全家来说是悲伤的一天，来到我们家十一天的小芦花鸡大毛不幸在我们的后院失踪了，而且最可能是被鹰之类的飞禽捉走了。本来它们是在纸箱里，上面盖着。因为味有点大，太太把纸箱放后院deck上。风大把盖子吹掉了，小鸡就自己跑了出来，可我们不知道，不然一定会看着它们的，因为以前就有小鹰虎视眈眈的站fence上看我们的小鸟。&lt;br /&gt;六月7日，两只小芦花鸡刚刚落户我们家，大概有一周多大，浑身黄白棕黄色的毛，一只颈背棕色毛多的，我们给它取名一撮毛，另一只颈两侧各有些棕毛，我们叫它俩撮毛，后来就简称大毛二毛。大毛二毛很招人喜爱，总是小声小气的鸡鸡个不停，甚至在边吃饭睡觉时也会唧唧，即像在呼唤同伴，又像在表达很好很舒服很好吃。失去了大毛，让我想起了鲁迅《祝福》里的祥林嫂，好在很快，我们又收养了新的小鸡，给了我们一些抚慰。&lt;br /&gt;失去大毛那天，太太带着孩子去买回两只新小鸡，它们是那么小，恐怕刚出生一两天而已，刚来时，站着就要睡着了，也不大吃东西，好像不知道怎么吃。我们叫它俩团团和圆圆，寄予小鸡一家团圆。为了不再老让孩子们想起大毛伤心，我们叫二毛为芦花。&lt;/p&gt;&lt;p&gt;团团圆圆一来就把芦花当作妈妈，总往芦花的翅膀和肚子下钻。好在芦花很nice,从开始觉得很wierd，到后来就顺其自然，带着两个小妹妹吃饭睡觉草地里跑来跑去。鸡食很让我们发愁，不知道它们爱吃什么，于是给它们吃麦片燕麦片，玉米面拌菜，还有苍蝇。天好时我们经常在后院坐板凳上，地上铺着小鸡pupu的报纸，举着苍蝇拍打苍蝇。小鸡们知道啪一声响就有好吃的，所以经常等在身旁，甚至迫不及待的自己追苍蝇，当然总是一无所获。它们快乐的长大着。为了区分两只小的，我们在圆圆小鸡翅膀上mark黑颜色，就叫它小黑。后来我们又从别人那买回一只毛黑一点的小鸡，主人说5月底买的，叫Fluffy,可个头比芦花还小，它以前常被同养的两只小鸭子欺负，胆子很小，好在很快就和芦花团团圆圆和睦相处,我叫它毛毛。它也很快学会吃苍蝇。六月28日周二，我因有事去了办公室，不幸happens again:太太把小鸡放在纸箱里，然后放deck上。为了透气，我在纸箱上给大毛二毛开了些小窗口，可团团圆圆小，可以从窗口跑出来，太太从后院进屋，随手关拉门，没想到从纸箱外逃出来的小圆圆跟在后面，被挤，不幸。为了不让Emily伤心，我急忙从办公室赶回，几经周折，去卖鸡家又买了个小鸡，找不到大一点的，新小鸡叫声响亮，可不大会吃，总想睡觉。因太小，没法骗小孩，只好说farmer要求把小圆圆换走了。这个小家伙，我叫它球球，因为它跑起来像个滚动的棉花球。它长的好像很慢，都过了一个多星期，它还和刚来时差不多大。它睡觉喜欢钻到芦花的翅膀或肚子下，有时芦花已经趴下，小球球会跳到芦花背上，一旦芦花站起来，小球就有机会钻了。&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV7rRnngndMgqp3HL5oii4CrUqFBVX4V_TtvRmakDIDXow3s8v58d5hGtHRkPbGVZwaF1PrTwjAnO3K8CMCBC5Ps_jP9VcSfd8n-WCZwxe7gSK5ndd3x4Q1aXk_kVuczOgRPOtG9QunPoHOzEcBO9Ixi580yNLnyTxS8_1cJL7vAsaB3YTVhDwpWwK/s1600/IMG_20220707_142616.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1200&quot; data-original-width=&quot;1600&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV7rRnngndMgqp3HL5oii4CrUqFBVX4V_TtvRmakDIDXow3s8v58d5hGtHRkPbGVZwaF1PrTwjAnO3K8CMCBC5Ps_jP9VcSfd8n-WCZwxe7gSK5ndd3x4Q1aXk_kVuczOgRPOtG9QunPoHOzEcBO9Ixi580yNLnyTxS8_1cJL7vAsaB3YTVhDwpWwK/s320/IMG_20220707_142616.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;上周日(Jul 3），太太又从别人那买回两只小鸡，有大毛二毛来时大。这样我们就有6只小鸡了。&lt;br /&gt;芦花很喜欢在后院跑，每次它都是最难捉回来的。它甚至听得懂它的名字，每次听到我们喊芦花，就知道有苍蝇吃了，会从院子的不知那个角落连跑带飞的奔到我们打苍蝇的地方来。后来可能因小鸡太多了，小的小鸡时常在我们身旁等苍蝇吃，芦花再从远处赶来常吃不到，它就不大理会名字被叫到了。芦花很早就学会玩土洗澡了，有时就趴在我们种的西红柿旁的土地里，享受泥土和阳光浴。除了苍蝇，芦花和小鸡们很喜欢吃面条，也喜欢米饭。看小鸡们抢食物吃有时很好笑，小的小鸡抢到好吃的会飞快的在其它鸡面前钻来转去。芦花看着很大，可前几天我们给它称了，却还不到一磅。芦花不在外边跑时很乖，轻轻push它，它就肯安静地趴在我们的手和胳膊上。我们都在想芦花再大一点，就会给我们下蛋了。&lt;br /&gt;8日周五早，Rogers的cell phone和无线网同时down了。今天,六只小鸡一早就又被放出来，吃了些菜拌玉米面，喝了些水，在后院撒欢。突然芦花有些异样，站在草地里不动，我以为它在pupu，果然它拉了一点黑稀东西，可还是很不舒服，没过多久它就开始趴下了，连我走过去摸它，它也没再像以前那样run away。我抚摸了它，没多久它变得更加痛苦，头颈开始使劲扭动，很吓人，又让我们手足无措，不知怎样才能帮它，Rogers的网络还没回来，电话是好了，可我们都不知打给谁。我只能帮它按摩腹部，有那么一刻，芦花又站起来，跑开了，让我以为一切转危为安了，可没多久芦花又趴下了。眼睛也不愿睁开了。生命在慢慢逝去。在最后的一刻里，芦花再次从我的手足挣扎出去，跑到了它心爱的西红柿旁的土地里。我把它再次抱回手里没多久，它终于解脱了，安详的躺在我的胳膊上。&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTtY2QSYHVG0LQsMjwGXvJyURMSiO_RWfBhkO-7TM70vyGJbsMr204075iCaU0T5GKdwgvlWvDehQRcgGhJGj2fhbCMS8yrcZTdZPrmpbG4PmnHiSYHoMIq-ZT6M9pp_O8tPSu5NQ9H_IrNxFa6hJ9Zo4JraGEwE-FgnYvR43T3qNDGJpaAvXs5yhg/s5632/IMG_20220710_102432.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;320&quot; data-original-height=&quot;5632&quot; data-original-width=&quot;4224&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTtY2QSYHVG0LQsMjwGXvJyURMSiO_RWfBhkO-7TM70vyGJbsMr204075iCaU0T5GKdwgvlWvDehQRcgGhJGj2fhbCMS8yrcZTdZPrmpbG4PmnHiSYHoMIq-ZT6M9pp_O8tPSu5NQ9H_IrNxFa6hJ9Zo4JraGEwE-FgnYvR43T3qNDGJpaAvXs5yhg/s320/IMG_20220710_102432.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;我们把它埋在香椿树和桑树下，离小圆圆埋葬的地方很近，希望它在天堂与一撮毛还有小圆圆团聚。&lt;br /&gt;生命有时是如此的脆弱，我们在不知不觉中付出了关爱，在那一刻被残忍的剥夺了。在我们眼前耳边缠绕着它们的身影和声音，我们恐怕不再有勇气去收养新的小鸡。&lt;br /&gt;愿小芦花安息&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/B1hRSmRZNhk&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt; </content><link rel='replies' type='application/atom+xml' href='http://dencode.blogspot.com/feeds/1850833846581165431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dencode.blogspot.com/2022/07/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1850833846581165431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4725034836547244528/posts/default/1850833846581165431'/><link rel='alternate' type='text/html' href='http://dencode.blogspot.com/2022/07/blog-post.html' title='我的小鸡们'/><author><name>QYQ</name><uri>http://www.blogger.com/profile/00441410400065842104</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV7rRnngndMgqp3HL5oii4CrUqFBVX4V_TtvRmakDIDXow3s8v58d5hGtHRkPbGVZwaF1PrTwjAnO3K8CMCBC5Ps_jP9VcSfd8n-WCZwxe7gSK5ndd3x4Q1aXk_kVuczOgRPOtG9QunPoHOzEcBO9Ixi580yNLnyTxS8_1cJL7vAsaB3YTVhDwpWwK/s72-c/IMG_20220707_142616.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>