Hi Eduard,

Sure

just go to nuttx directory and apply it:
git apply 0001-Replace-Linux-symlinks-with-junction-on-WSL.diff

I do it right after clone/checkout  of Nuttx source

-Alexander

On Mon, Apr 6, 2020 at 5:39 PM Eduard Niesner <niesneredu...@gmail.com>
wrote:

> Hi Alexander,
>
> Can you share your script and some instructions on how to use it?
>
> Thank you,
> Edi
>
> On Sun, Apr 5, 2020 at 11:19 PM Alexander Oryshchenko <
> a.oryshche...@gmail.com> wrote:
>
> > path -> patch, I lost characters sometimes :)
> >
> > вс, 5 апр. 2020 г., 23:17 Alexander Oryshchenko <a.oryshche...@gmail.com
> >:
> >
> > > Hi,
> > >
> > > For second your question I can little bit help you. I wrote path which
> > > replases "ln" command in link.sh with Windows links. Then both WLS and
> > > Windows understand it fine and you will not need to create directory
> and
> > > copy. But I have no idea about your first question.
> > >
> > > -Alexander
> > >
> > > вс, 5 апр. 2020 г., 23:12 Eduard Niesner <niesneredu...@gmail.com>:
> > >
> > >> Hi Alexander,
> > >>
> > >> I debug my application using Visual Studio and when I try to step-in a
> > >> function from Nuttx it looks for the source files in
> > >> C:\SysGCC\arm-eabi\mnt\d\work\NuttxH7\Nuttx\arch\arm\src\
> > >> *chip\<filename>.c. *Since the "chip" folder is a simbolic link and is
> > not
> > >> accessible from Windows, Visual Studio cannot access it either.
> > >>
> > >> Since Visual Studio looks for the files in the "chip" folder, I need
> to
> > >> create it and copy the files from stm32H7 to it. This way, I am able
> to
> > >> debug my application and step in Nuttx functions as well.
> > >> I did not have the two issues from my initial email when I build Nuttx
> > >> with
> > >> Cygwin. I remember that the Nuttx/Apps repositories could not anywhere
> > on
> > >> my PC and also, the chip folder was always created after a successful
> > >> build
> > >> and its content was identical to the stm32H7 folder. So I did not have
> > to
> > >> do anything ... I was just doing a build and using the .a library in
> my
> > >> application and I was able to debug just fine.
> > >>
> > >> Also, I dont want to go back to Cygwin because in my experience,
> Cygwin
> > is
> > >> very slow compared to Ubuntu Bash. I am looking for a solution so
> that I
> > >> dont have do the two steps (copy Nuttx and Apps in the "
> > >> C:\SysGCC\arm-eabi\mnt\d...." and copy stm32H7 content in chip
> folder.)
> > >>
> > >> Thank you,
> > >> Edi
> > >>
> > >> On Sun, Apr 5, 2020 at 9:46 AM Alexander Oryshchenko <
> > >> a.oryshche...@gmail.com> wrote:
> > >>
> > >> > Hello Eduard,
> > >> >
> > >> > Regarding you second question.
> > >> > arch/arm/source/chip and board are symbolic links. They are
> accessible
> > >> > under WSL (but at least for me inaccessible in Windows). But why do
> > you
> > >> > need to copy something here?
> > >> >
> > >> > -Alexander
> > >> >
> > >> > On Sat, Apr 4, 2020 at 11:39 PM Eduard Niesner <
> > niesneredu...@gmail.com
> > >> >
> > >> > wrote:
> > >> >
> > >> > > Hi all,
> > >> > >
> > >> > > I am using the Nuttx build as a static library (*.a file) in my
> > >> > application
> > >> > > and in order to debug Nuttx I have to do some steps that I did not
> > >> have
> > >> > to
> > >> > > do in the past:
> > >> > >
> > >> > >    1. Copy Nuttx and Apps folders to the following directory
> > >> > >    C:\SysGCC\arm-eabi\mnt\d\work\NuttxH7
> > >> > >       - I know that in the past the static library had the right
> > debug
> > >> > >       symbols and was always pointing to the right file location
> in
> > my
> > >> > > Nuttx/Apps
> > >> > >       folders.
> > >> > >       - I checked the debug symbols from the nuttx static library
> > >> using
> > >> > >       eabi-objdump and it seems like the paths do not point to my
> > >> > > Nuttx/Apps
> > >> > >       folders anymore - now, they all point to
> > >> > C:\SysGCC\arm-eabi\mnt\d....
> > >> > >       - I recently changed from using Cygwin to Ubuntu Bash under
> > >> Windows
> > >> > >       10 because it is a lot faster than Cygwin. Can this be the
> > >> reason
> > >> > > why the
> > >> > >       paths in the static library have changed to
> > >> > > C:\SysGCC\arm-eabi\mnt\d...?
> > >> > >       - If yes, is there a option in Nuttx or in Ubuntu Bash to
> > >> generate
> > >> > >       the correct paths?
> > >> > >    2. Copy the content from
> > >> > >
> > C:\SysGCC\arm-eabi\mnt\d\work\NuttxH7\Nuttx\arch\arm\src\*stm32h7*
> > >> to
> > >> > >    C:\SysGCC\arm-eabi\mnt\d\work\NuttxH7\Nuttx\arch\arm\src\*chip*
> > >> > >       - I noticed that after a successful build the "chip" folder
> is
> > >> not
> > >> > >       created anymore and instead there is a "chip" file.
> > >> > >       - Now I have to delete the "chip" file, create a "chip"
> folder
> > >> and
> > >> > >       copy the source files from "stm32H7" folder.
> > >> > >       - Can this be related to the Cygwin vs Ubuntu Bash as well?
> > >> > >
> > >> > > Also, in my configuration the "Suppress Optimization" and
> "Generate
> > >> Debug
> > >> > > Symbols" are checked.
> > >> > >
> > >> > > Any suggestions are welcome.
> > >> > >
> > >> > > Thanks,
> > >> > > Edi
> > >> > >
> > >> >
> > >>
> > >
> >
>
diff --git a/tools/link.sh b/tools/link.sh
index 496d19ed16..2ebea8afd6 100755
--- a/tools/link.sh
+++ b/tools/link.sh
@@ -92,8 +92,20 @@ fi
 
 # Create the soft link
 
-ln -s "${src}" "${dest}" || \
+dest_fp=$(realpath ${dest})
+if [ $(expr match "$(< /proc/version)" "Linux.*Microsoft") -gt 0 ] &&  [ 
$(expr match "${dest_fp}" "/mnt/[a-z]/") -gt 0 ] ; then
+  src_fp=$(realpath ${src})
+  src_win=$(echo $(echo ${src_fp} | sed -E 's/\/mnt\/([a-z])\//\1:\//g') | sed 
's/\//\\/g')
+  dest_win=$(echo $(echo ${dest_fp} | sed -E 's/\/mnt\/([a-z])\//\1:\//g') | 
sed 's/\//\\/g')
+  cmd.exe /c mklink /J "${dest_win}" "${src_win}"
+  if [ ! -h ${dest} ]; then
+    echo "Failed to create link: $dest"
+    exit 1
+  fi
+else
+  ln -s "${src}" "${dest}" || \
   { echo "Failed to create link: $dest" ; exit 1 ; }
+fi
 
 # Verify that the link was created
 

Reply via email to