flashing nuttx RTOS to stm32F4developer from windows - windows

I installed Ubuntu terminal as now Windows 10 supports it. I built the Nuttx RTOS using the terminal but in Ubuntu I cannot access USB devices except for a pen drive.
How can I flash the bin file to stm32f4developer?

You can use windows tools. All of the files in the Ubuntu "sandbox" can be access by Windows tools running outside of that sandbox. In the top-level NuttX README:
Accessing Ubuntu Files From Windows
In Ubuntu Userspace for Windows, the Ubuntu file system root directory is
at:
%localappdata%\lxss\rootfs
Or
C:\Users\Username\AppData\Local\lxss\rootfs
However, I am unable to see my files under the rootfs\home directory.
After some looking around, I find the home directory
%localappdata%\lxss\home.
With that trick access to the /home directory, you should actually be
able to use Windows tools outside of the Ubuntu sandbox with versions of
NuttX built within the sandbox using that path.

As user6711188 explained you can access your home at %localappdata%\lxss\home or you can copy the nuttx.bin directly to Windows side:
$ cp nuttx.bin /mnt/c/ProgramData/
You will need to configure Windows Explorer to show Hidden files, this way you could see the nuttx.bin at C:\ProgramData
More info: https://acassis.wordpress.com/2018/01/10/how-to-build-nuttx-on-windows-10/

Related

How to Uninstall Git for Windows SDK?

Git for Windows SDK apparently uses over 5.25GB of disk space and I have no use for developer kit bloat. Now I want to uninstall but I could not find any instructions online or in documentation. On Windows 7 after install there is no uninstall.exe and no uninstall listing in Programs list. Everything seems to be under the directory:
c:\git-sdk-64
So I would just delete that directory.
I don't see any additions to the Windows path that seem to relate to the Git for Windows SDK.
My basic goal is just to use AVRdude and AVR Toolchain for Windows under windows 7 as described in the instructions here:
https://www.pololu.com/docs/0J67/5.5
where I need Msys2 with pacman to install AVRdude, and I would install tree command, and I want to use a Linux command environment on Windows and Linux to develop AVR Programming resources in a cross platform manner. Any advice from experience would be appreciated since I don't want to pollute my Windows 7.
EDIT - Using windows file explorer, right click on sdk folder, properties, size shown is 5.49GB on disk. I don't see any links installed in the Program menu and I doubt there are other files installed anywhere else. So I am just going to delete this whole folder.
When first installed, the console prompt a clonning action from the github repository. Furthermore, the path choose has a .git folder in it where current status and branches can be seen through command line (with git status).
I havent' seen or ask for the code of the executable, as it might link or copy to other paths, but to me it's very probable it just downloads the github repo and compiles some executables (as files are not exactly the same as in the repo).
The only thing to care is the link created to desktop.

Is there a way to access a WSL folder from the Windows host or vice versa?

I've Windows 2010 home ed installed and on top i have installed Ubuntu extension support by Windows.
I've started wrting my project there but not sure
how to access directory in Ubuntu from my windows system (host)
any thoughts? Thanks in advance
I'd prefer to not use any external tool for it.
In Windows10 after the may 2019 update, the expected way to access WSL files from windows is via the mounted network drive.
You can access it at \\wsl$\<distro> via explorer, etc. You can even just launch explorer from wsl by running explorer.exe from your WSL shell.
See the dev blog post here for more info: https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/
To access the Windows10 filesystem you can just use the mounted filesystem at /mnt/<drive_letter> in WSL
figured out lately and as mentioned by #imbuedHope, from wsl command bash shell, you can open current directory by specifying . as follows:
explorer.exe . //notice the dot
then u could navigate using windows explorer to wherever u want.
In Windows 11 Home, the Linux/Ubuntu folder automatically shows up in Windows Explorer.
In Linux/Ubuntu, the Windows filesystem shows up under /mnt/<mountname>/c. [The "mountname" was a choice provided during the WSL2 installation.] I can access Windows "My Documents" folder through the path: /mnt/arun/c/Users/arun/Documents/.

How to add git to PATH (Bash on Windows)

I am using Bash on Ubuntu on Windows, and I installed git. How do I add git to my PATH?
The General command is (using setx):
setx PATH=%PATH%;C:\path\to\Git\bin
On WSL (Windows Subsytem for Linux), you would type, after installation:
which git
It should be already in your PATH (/usr/bin or /usr/local/bin)
If it is not, you can try and find it: find / -name "git", and add it to your ~/.profile with:
export PATH=$PATH:/path/to/git
But be aware the WSL will install an old version of Git.
Fir the most recent one, use:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git-core
Where is /usr/local/bin on Windows?
As mentioned in BashOnWindows issue 402:
Under C:\Users\**user**\AppData\Local\lxss, You will find:
root folder
home folder
and a hidden rootfs folder (\bin, \boot, \dev, \etc...)
DON'T CHANGE ANYTHINK INSIDE! SERIOUSLY! 🚨
Access Windows files via /mnt/**letter**/
And:
Maybe I don't fully understand what Bash on Ubuntu on Windows is.
See Wikipedia WSL entry:
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10.
Windows Subsystem for Linux is only available on 64-bit editions of Windows 105 and can be activated on Windows 10 Anniversary Update and later.
WSL uses fewer resources than a full virtualized machine, the most direct way to run Linux software on a Windows computer, while also allowing users to use Windows apps and Linux tools on the same set of files.5
The OP adds:
So if I install git and it's in /usr/bin/git, does that correspond to a particular folder such as C:\Program Files\etc...?
Yes, under C:\Users\**user**\AppData\Local\lxss\rootfs\usr\..., but you are not supposed to access it directly. You only use it through the WSL bash.
Is setting my PATH different by putting it in my ~/.profile vs. going into Control Panel --> System Properties --> Environment Variables
Yes, completely. If you want to set your Windows Environment Variables PATH, you need to use Git for Windows, as described in here.
The solution assumes u want to access git inside WSL in your Windows Environment
Check this Out
https://github.com/ardevd/gitwrap/releases
This wrapper pipes output from WSL to windows and also works on android studio claimed by the developer
This Wrapper was not developed by me
for any issues plz post on the github page

Bash on Windows - debug a python file with Visual Code or Visual Studio

I have a python file in my Bash on Windows environment.
Is it possible to debug it with Visual Code or Visual Studio?
Can a debugger be attached to the Linux python version that exists in the Bash on Windows environment?
I think you've got a few options for this. If you're attempting to debug a python file that's saved on your home directory in Bash on Windows, you can navigate to your home directory in Windows by going to "C:\Users\[windows username]\AppData\Local\lxss\home\[ubuntu username]\". Then you can open any of your projects or files saved on your home folder in Ubuntu. You can even make a shortcut on your desktop or something to make it easier to access this folder.
However, if you need the environment that you have on Bash for dependencies or python modules, your other option is to install a GUI and Linux-compatible IDE of your preference on Ubuntu, and use Xming on Windows to run the IDE on your screen. A tutorial on how to do this can be found here.
If you need to debug a linux python program from Visual Studio, a simple Google search yielded this. I haven't tried it but this seems to be the solution you are looking for. For connecting over the network to Bash on Windows from Windows, use localhost for the host.
Your best bet might be to just move the file. Your normal windows system is mounted under /mnt/c.
You can just copy it to your desktop by doing
cp (path to your file) /mnt/c/(your username)/Desktop
When you need to access or edit it from bash, just cd to that location (or wherever else you choose to store it).
Interesting other idea: you could mount cloud storage (e.g. google drive) via fuse in linux then set it up in windows. Copy the python to it and you can edit in windows and access in linux as needed. (Google is your friend here; look into google-drive-ocamlfuse or gdrivefs).
Hope this helps!
jBit
I would suggest making use of the Remote - WSL extension for Visual Studio code. It allows you to easily access your Windows Subsystem for Linux (WSL) and use it as a full-time dev environment.
Here is an article on how to set up Visual Studio Code Remote-WSL.
After that is set up, you can quickly load your python file in the VS Code editor using a command like: code path/to/python_file.py

The Lxss folder in windows for Bash on Ubuntu on Windows is missing

Problem and Hypothesis
It's a pretty simple problem, I just can't find the Lxss folder in LocalAppData which is suppose to store files from the Bash on Ubuntu on Windows.
I only see one of two possibilities for why this is. Either Windows moved the Lxss folder in an update for Bash on Ubuntu on Windows, or it is an error specific to my system that has caused Windows not to create the Lxss folder. I don't think this is the possibility though because it is a fresh install of windows.
Steps I have tried:
Unhiding files and folders in windows
Shutting down Bash on Ubuntu on Windows and refreshing my LocalAppData
Restarting Windows and checking my LocalAppData
Screenshots of LocalAppData:
I can add more information if needed.
It was actually moved in the latest release to :
C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\
See this blog post from WLS git repo
You have to uncheck "Hide protected operating system files (recommended)" in the folder options window.
The selected solution is old and valid for Ubuntu only.
For Opensuse leap-15.1 users this is different:
C:\Users\"yourusername"\AppData\Local\Packages\46932SUSE.openSUSE-Leap-15-1_022rs5jcyhyac\LocalState\rootfs
The numbers will differ from version to version and may change in the future.
The trick is to look for something related to Linux in C:\Users\"yourusername">\AppData\Local\Packages\"xxxxx"\LocalState\root\fs
where
"yourusername" is your Windows 10 user login
"xxxxx" is a custom name related to the Linux distribution installed
In the latest version of Windows Fall Creator Update, I found it in C:\Users\%USERNAME%\AppData\Local\lxss\

Resources