You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Tim <Ti...@JTi.uk.com.INVALID> on 2021/05/11 16:41:53 UTC

Dev environment

Pulling my hair out here!! So apologies for the lengthy brain dump and plea
for help!

 

All this starts from the CAN init code crashing (SAMA5D27) when it makes any
call to print debug messages. Printf itself is fine.

 

I need to debug it. I will need to get to that point regardless.

 

The only way I can actually get Nuttx to build is using WSL - compiles no
problem at all. I have a MAC - it won't compile without errors and there's
not enough info (for me) to see what the error is - some complaint about
./builtin_list.c

 

Mac is the machine I know least. I have no "full" Linux machine. No
experience of Cygwin and its ilk - just a minefield to me.

 

I know Windows best, and have successfully used eclipse under Windows for
Arm development for many years (sometimes compiling within eclipse,
sometimes from a command prompt). But although I can download and run code
via my jlink, eclipse will not correctly index the source code so I cannot
debug or set breakpoints.

 

So I went back to trying to get it to compile under the Mac but no joy so
not even got as far as seeing if eclipse - or any other debugger- will run
and do its job. Eclipse is pointing at the source code properly and even if
I stop the program and manually point the eclipse debugger to the source
code - where I have inserted a while(1); - it completely refuses to pick up
the source code. I am suspected a "\" vs "/" issue or something dumb. This
is true either for a project pointing to a clone in the WSL location or in a
more native windows location

 

I have not succeeded in getting Nuttx to build via eclipse (in Windows)
either - although my "Bare Metal"  SAMA5 code compiles just fine with the
eclipse GNU cross compilers and debugs nicely.

 

I thought maybe I could run an X-windows emulator on my Win 10 machine and
run eclipse on WSL...but it doesn't get very far and just throws errors.

 

Thought I'd try Visual GDB - no SAMA5D2 support it seems. Tried to run
OpenOCD (which purported to be "Windows ready") but it doesn't run.

 

Has anyone got NuttX to successfully compile, and allow debug, under either
MAC or Windows. At all? Ever?

 

If someone has any pointers I will be extremely grateful, as this is doing
my head in. I really don't want to waste yet more days finding a machine to
build up exclusively for Linux unless I REALLY have to!!!


Re: Dev environment

Posted by Frank-Christian Kruegel <nu...@istda.com>.
Am 11.05.2021 um 18:41 schrieb Tim:
> Mac is the machine I know least. I have no "full" Linux machine. No
> experience of Cygwin and its ilk - just a minefield to me.

The best way would be a virtual machine using Virtualbox 
(https://www.virtualbox.org) (free) or VMWare Player
(https://www.vmware.com/de/products/workstation-player.html) (free for 
non-commercial use).

Install it, then download Ubuntu 20.04 Desktop 
(https://releases.ubuntu.com/20.04/), and you have everything you need. 
You can also reroute USB devices into your virtual machines, so using a 
JTAG/SWD debugger will work.

Caveat: Check your BIOS setting for something like "VT Virtualization 
support" and enable it. The virtualizers need the CPU hardware 
virtualization support to be enabled.

Frank-Christian

RE: Dev environment

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
> Disruptive Solutions Tue, 11 May 2021 09:50:53 -0700 wrote

>Maybe I can try to help you concerning this matter. How can we
>connect? Do you have telegram?

WhatsApp, Signal, email, FB Messenger...but not Telegram :) Email me if you like and we can go from there - guess you will need to remove the rather odd .INVALID that seems to be added in to my email address via this system.



Re: Dev environment

Posted by Tim Hardisty <Ti...@JTi.uk.com.INVALID>.
I see from https://www.mail-archive.com/dev@nuttx.apache.org/ that others have replied. These have not got through to me so apologies for not yet taking up the offers of assistance.

I will try and sort whatever the email issue is and then reply!







Re: Dev environment

Posted by Disruptive Solutions <di...@gmail.com>.
You can also use Virtualbox. I use this for my NuttX CI/CD. Works nice!
Ben

>
>

Re: Dev environment

Posted by Brennan Ashton <ba...@brennanashton.com>.
For what it's worth, there are a bunch of people here that use macOS
(including our CI testing) and I have used both Cygwin and WSL. So if there
is a problem with any of these it is very important that we work with you
to resolve it rather than drive you to another OS where you may run into
the exact same problem.


So back to your root issue, you said you were having issue setting
breakpoint and getting that to line up with the code, did you enable the
debug symbols in menu config?

Are you able to flash the device using the eclipse debugger?

--Brennan

On Tue, May 11, 2021, 1:07 PM Tim Hardisty <Ti...@jti.uk.com.invalid> wrote:

> Hmm...do need Windows for my schematic capture and 3D design applications,
> but Mac little used as yet...I'm thinking dual boot Mac/Ubuntu is probably
> the way to go!
>
> On 11/05/2021, 20:30, "Alan Carvalho de Assis" <ac...@gmail.com> wrote:
>
>     Also, if you are not dependent on Windows, just install Linux on your
>     computer, it will avoid all those tricks to get the work done ;-)
>
>
>
>
>

Re: Dev environment

Posted by Tim Hardisty <Ti...@JTi.uk.com.INVALID>.
Hmm...do need Windows for my schematic capture and 3D design applications, but Mac little used as yet...I'm thinking dual boot Mac/Ubuntu is probably the way to go!

On 11/05/2021, 20:30, "Alan Carvalho de Assis" <ac...@gmail.com> wrote:

    Also, if you are not dependent on Windows, just install Linux on your
    computer, it will avoid all those tricks to get the work done ;-)





Re: Dev environment

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Also, if you are not dependent on Windows, just install Linux on your
computer, it will avoid all those tricks to get the work done ;-)

On 5/11/21, Tim Hardisty <Ti...@jti.uk.com.invalid> wrote:
> Thanks Alan. Compiling is no problem it is debugging that is my issue. I see
> from your process that you copied the elf from the WSL environment to the
> Windows /mnt/c ...I haven't tried that but I am not sure it will help
> eclipse find the source code...unless I also replicate the source tree on
> the Windows side perhaps. It is a few more things to try at least, so thank
> you.
>     >Hi Tim,
>    >
>     >I don't use Windows or MacOS, but some time ago just tested NuttX on
>     >WSL to help other to get started to NuttX on Windows, I documented the
>     >process here:
>    >
>
>>https://acassis.wordpress.com/2018/01/10/how-to-build-nuttx-on-windows-10/
>     >
>     >I hope it helps you!
>
>     >> I need to debug it. I will need to get to that point regardless.
>     >>
>
>
>
>

RE: Dev environment

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
>Brennan Ashton Tue, 11 May 2021 13:12:50 -0700 wrote

>So back to your root issue, you said you were having issue setting
>breakpoint and getting that to line up with the code, did you enable the
>debug symbols in menu config?

Yes:
- Enable Debug Features checked
- Enable Error Output checked
- Enable Warnings Output checked 
- Enable Information Debug Output checked
- Enable Debug Assertions checked
- CAN Debug Features/Error Output/Warning output all checked
- Optimization supressed to give the debugger the best chance

Can't find anything else right now, so hopefully I got everything checked that I need.

>Are you able to flash the device using the eclipse debugger?
I have flashed the AT91bootloader and Uboot using the Jlink and a sam-ba calls from a good-old DOS batch file. Works fine. Code is downloaded via JTAG from within eclipse no problem at all.


Re: Dev environment

Posted by Tim Hardisty <Ti...@JTi.uk.com.INVALID>.
I have the board booting from AT91bootstrap and Uboot, from QSPI no problem. Downloading code using JLink from Windows/eclipse is fine, but the debugging is broken/mis-configured. I will probably have another go at a Windows-hosted development environment and have the arm cross compilers installed already: since it works for the Atmel "softpack" stuff from which I derived my initial board debugging code (before moving to NuttX) I see no reason why it shouldn't work for NuttX using tool chains, within Eclipse, once I finally get my head around it and find the magic trick!

Seems I have a few things more to try now, at least.

On 11/05/2021, 18:36, "Gregory Nutt" <sp...@gmail.com> wrote:


    >> It seems that it is possible to run JLink from Windows in WSL.
    >I used J-Link under Windows to bring up the SAMA5Dx.  The only tricky 
    >thing was booting from an SD card with U-boot.



Re: Dev environment

Posted by Gregory Nutt <sp...@gmail.com>.
> It seems that it is possible to run JLink from Windows in WSL.
I used J-Link under Windows to bring up the SAMA5Dx.  The only tricky 
thing was booting from an SD card with U-boot.

Re: Dev environment

Posted by Flavio Castro Alves Filho <fl...@gmail.com>.
It seems that it is possible to run JLink from Windows in WSL.

Em ter., 11 de mai. de 2021 às 14:23, Tim Hardisty
<Ti...@jti.uk.com.invalid> escreveu:
>
> Thanks Alan. Compiling is no problem it is debugging that is my issue. I see from your process that you copied the elf from the WSL environment to the Windows /mnt/c ...I haven't tried that but I am not sure it will help eclipse find the source code...unless I also replicate the source tree on the Windows side perhaps. It is a few more things to try at least, so thank you.
>     >Hi Tim,
>    >
>     >I don't use Windows or MacOS, but some time ago just tested NuttX on
>     >WSL to help other to get started to NuttX on Windows, I documented the
>     >process here:
>    >
>     >https://acassis.wordpress.com/2018/01/10/how-to-build-nuttx-on-windows-10/
>     >
>     >I hope it helps you!
>
>     >> I need to debug it. I will need to get to that point regardless.
>     >>
>
>
>


-- 
Flavio de Castro Alves Filho

flavio.alves@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves

Re: Dev environment

Posted by Tim Hardisty <Ti...@JTi.uk.com.INVALID>.
Thanks Alan. Compiling is no problem it is debugging that is my issue. I see from your process that you copied the elf from the WSL environment to the Windows /mnt/c ...I haven't tried that but I am not sure it will help eclipse find the source code...unless I also replicate the source tree on the Windows side perhaps. It is a few more things to try at least, so thank you.
    >Hi Tim,
   >
    >I don't use Windows or MacOS, but some time ago just tested NuttX on
    >WSL to help other to get started to NuttX on Windows, I documented the
    >process here:
   >
    >https://acassis.wordpress.com/2018/01/10/how-to-build-nuttx-on-windows-10/
    >
    >I hope it helps you!

    >> I need to debug it. I will need to get to that point regardless.
    >>




Re: Dev environment

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Tim,

I don't use Windows or MacOS, but some time ago just tested NuttX on
WSL to help other to get started to NuttX on Windows, I documented the
process here:

https://acassis.wordpress.com/2018/01/10/how-to-build-nuttx-on-windows-10/

I hope it helps you!

BR,

Alan

On 5/11/21, Tim <Ti...@jti.uk.com.invalid> wrote:
> Pulling my hair out here!! So apologies for the lengthy brain dump and plea
> for help!
>
>
>
> All this starts from the CAN init code crashing (SAMA5D27) when it makes
> any
> call to print debug messages. Printf itself is fine.
>
>
>
> I need to debug it. I will need to get to that point regardless.
>
>
>
> The only way I can actually get Nuttx to build is using WSL - compiles no
> problem at all. I have a MAC - it won't compile without errors and there's
> not enough info (for me) to see what the error is - some complaint about
> ./builtin_list.c
>
>
>
> Mac is the machine I know least. I have no "full" Linux machine. No
> experience of Cygwin and its ilk - just a minefield to me.
>
>
>
> I know Windows best, and have successfully used eclipse under Windows for
> Arm development for many years (sometimes compiling within eclipse,
> sometimes from a command prompt). But although I can download and run code
> via my jlink, eclipse will not correctly index the source code so I cannot
> debug or set breakpoints.
>
>
>
> So I went back to trying to get it to compile under the Mac but no joy so
> not even got as far as seeing if eclipse - or any other debugger- will run
> and do its job. Eclipse is pointing at the source code properly and even if
> I stop the program and manually point the eclipse debugger to the source
> code - where I have inserted a while(1); - it completely refuses to pick up
> the source code. I am suspected a "\" vs "/" issue or something dumb. This
> is true either for a project pointing to a clone in the WSL location or in
> a
> more native windows location
>
>
>
> I have not succeeded in getting Nuttx to build via eclipse (in Windows)
> either - although my "Bare Metal"  SAMA5 code compiles just fine with the
> eclipse GNU cross compilers and debugs nicely.
>
>
>
> I thought maybe I could run an X-windows emulator on my Win 10 machine and
> run eclipse on WSL...but it doesn't get very far and just throws errors.
>
>
>
> Thought I'd try Visual GDB - no SAMA5D2 support it seems. Tried to run
> OpenOCD (which purported to be "Windows ready") but it doesn't run.
>
>
>
> Has anyone got NuttX to successfully compile, and allow debug, under either
> MAC or Windows. At all? Ever?
>
>
>
> If someone has any pointers I will be extremely grateful, as this is doing
> my head in. I really don't want to waste yet more days finding a machine to
> build up exclusively for Linux unless I REALLY have to!!!
>
>

Re: Dev environment

Posted by Nathan Hartman <ha...@gmail.com>.
On Mon, May 24, 2021 at 1:04 PM Tim Hardisty <Ti...@jti.uk.com.invalid>
wrote:

> With thanks to Flavio's suggestion (and .json file to point me in the
> right direction) I now have VS Code running under Ubuntu as a full IDE -
> edit/build/debug with Segger jlink all from within VS Code
>
> Had to create custom scripts in the launch.json file to ensure no reset
> on download of nuttx to my sama5d27 otherwise it messed with the
> bootstrap+Uboot config of the processor. Also a bit of faffing to get
> the arm-none-eabi tools from ARM to work (lots of symbolic links needed).
>
> Is this worth documenting and sharing anything anywhere?


Yes!

If you wish to do so, feel free to send a PR. This may be helpful to many
people.

Thanks!

Nathan

Re: Dev environment

Posted by Tim Hardisty <Ti...@JTi.uk.com.INVALID>.
With thanks to Flavio's suggestion (and .json file to point me in the 
right direction) I now have VS Code running under Ubuntu as a full IDE - 
edit/build/debug with Segger jlink all from within VS Code

Had to create custom scripts in the launch.json file to ensure no reset 
on download of nuttx to my sama5d27 otherwise it messed with the 
bootstrap+Uboot config of the processor. Also a bit of faffing to get 
the arm-none-eabi tools from ARM to work (lots of symbolic links needed).

Is this worth documenting and sharing anything anywhere? I know the 
processor is perhaps a bit obscure, but it might help someone - if so, 
please let me know where/how to best share my information, otherwise I 
will simply document as part of my own project.

Tomorrow will see the start of actually debugging the cause of the 
CANbus driver crashes, but I can now actually do this with proper tools 
at my disposal. And once fixed and proven I will then work out how to do 
pull requests to get the fixes made available...I'm nearly coding in the 
21st century now lol.

On 21/05/2021 20:51, Flavio Castro Alves Filho wrote:
> Hello Tim,
>
> I use VSCode with GDB and Segger.
>
> But Ubuntu does not come with GDB. So I use x-pack toolchain to build and debug.
>
> It works well.
>
> Best regards,
>
> Flavio
>
>
> Em sex., 21 de mai. de 2021 às 13:28, Tim <Ti...@jti.uk.com.invalid> escreveu:
>> Eventually got a Linux dev environment up and running (first PC purchased failed after a few hours...grrr...now have an Intel i5 NUC for this).  Amazed how darn fast compilation is compared to WSL (even on my 3.3GHz Zeon-based workstation with the -j6 make option) so that in itself means it was a great move! Always liked Linux anyway lol.
>>
>> Eclipse (latest version) still not playing ball - just won't debug. So I'm assuming a platform independent setup issue with it; aka finger trouble :(
>>
>> I am temporarily using Segger Ozone - worked first time and can finally debug. Not sure I like it but hey ho.
>>
>> As an aside, has anyone got a recommendation of a good, graphical, GDB debugger for Linux, that place nicely with NuttX? Not bothered about an IDE as such, and I'm 100% happy with building via terminal, but a feature rich and easy to use debugger that looks up the source code "thoroughly" is an essential.
>>
>> But, now I can set breakpoints, I found that lack of debug messages on the console was because the .config was sending them to RAM not CONSOLE, because that's what is in the sama5d2-xult defconfig file I based my custom config on.
>>
>> Simple explanation, but is this documented anywhere? Can't find that level of syslog stuff using make menuconfig?
>>
>> Also now, at least, I know that the board is crashing in can_hwinitialize when it calls can_putreg(priv, SAM_PMC_PCR, regval)...so next week's task is to find out what's up with this (it's not my code).
>>
>>>> On 5/12/21, Tim Hardisty <ti...@hardisty.co.uk> wrote:
>>>>>> From: Alan Carvalho de Assis <ac...@gmail.com>
>>>>>>
>>>>>> Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
>>>>>>
>>>>>>   │     -> Build Setup
>>>>>>                │
>>>>>>   │       -> Debug Options
>>>>>>                │
>>>>>>   │         -> Enable Debug Features (DEBUG_FEATURES [=y])
>>>>>>                │
>>>>>>   │           -> CAN Debug Features (DEBUG_CAN [=y])
>>>>>>
>>>>> Indeed I did. And, anyway, even if I hadn't my debug message might
>>>>> appear but the system would keep running, but it doesn't: it crashes.
>>>>> I have inserted the while(1) to narrow it down to where it
>>>>> crashes....it is the call to that debug message that does it :(
>>>>>
>>>> Try to put a sam_piowrite(PIO_LED_YOURLED, true/false); to between the
>>>> caninfo() and the while(1); just for a double check ;-)
>>>>
>>>> By PIO_LED_YOURLED I mean the LED that is turning ON when your board
>>>> initializes.
>>>>
>>>> Talking about LEDs... other important thing: normally when NuttX
>>>> crashes the board LED start to blink to indicate an issue, is it blinking on your
>>> board?
>>>
>>> This is a custom board, and no LED such as that. I have removed any LED-
>>> related stuff from the board.h file...is that the issue? Maybe NuttX absolutely
>>> depends on some kind of LED?
>

Re: Dev environment

Posted by Flavio Castro Alves Filho <fl...@gmail.com>.
Hello Tim,

I use VSCode with GDB and Segger.

But Ubuntu does not come with GDB. So I use x-pack toolchain to build and debug.

It works well.

Best regards,

Flavio


Em sex., 21 de mai. de 2021 às 13:28, Tim <Ti...@jti.uk.com.invalid> escreveu:
>
> Eventually got a Linux dev environment up and running (first PC purchased failed after a few hours...grrr...now have an Intel i5 NUC for this).  Amazed how darn fast compilation is compared to WSL (even on my 3.3GHz Zeon-based workstation with the -j6 make option) so that in itself means it was a great move! Always liked Linux anyway lol.
>
> Eclipse (latest version) still not playing ball - just won't debug. So I'm assuming a platform independent setup issue with it; aka finger trouble :(
>
> I am temporarily using Segger Ozone - worked first time and can finally debug. Not sure I like it but hey ho.
>
> As an aside, has anyone got a recommendation of a good, graphical, GDB debugger for Linux, that place nicely with NuttX? Not bothered about an IDE as such, and I'm 100% happy with building via terminal, but a feature rich and easy to use debugger that looks up the source code "thoroughly" is an essential.
>
> But, now I can set breakpoints, I found that lack of debug messages on the console was because the .config was sending them to RAM not CONSOLE, because that's what is in the sama5d2-xult defconfig file I based my custom config on.
>
> Simple explanation, but is this documented anywhere? Can't find that level of syslog stuff using make menuconfig?
>
> Also now, at least, I know that the board is crashing in can_hwinitialize when it calls can_putreg(priv, SAM_PMC_PCR, regval)...so next week's task is to find out what's up with this (it's not my code).
>
> >>On 5/12/21, Tim Hardisty <ti...@hardisty.co.uk> wrote:
> >>>>From: Alan Carvalho de Assis <ac...@gmail.com>
> >>>>
> >>>>Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
> >>>>
> >>>>  │     -> Build Setup
> >>>>               │
> >>>>  │       -> Debug Options
> >>>>               │
> >>>>  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
> >>>>               │
> >>>>  │           -> CAN Debug Features (DEBUG_CAN [=y])
> >>>>
> >>>
> >>> Indeed I did. And, anyway, even if I hadn't my debug message might
> >>> appear but the system would keep running, but it doesn't: it crashes.
> >>> I have inserted the while(1) to narrow it down to where it
> >>> crashes....it is the call to that debug message that does it :(
> >>>
> >>
> >>Try to put a sam_piowrite(PIO_LED_YOURLED, true/false); to between the
> >>caninfo() and the while(1); just for a double check ;-)
> >>
> >>By PIO_LED_YOURLED I mean the LED that is turning ON when your board
> >>initializes.
> >>
> >>Talking about LEDs... other important thing: normally when NuttX
> >>crashes the board LED start to blink to indicate an issue, is it blinking on your
> >board?
> >
> >This is a custom board, and no LED such as that. I have removed any LED-
> >related stuff from the board.h file...is that the issue? Maybe NuttX absolutely
> >depends on some kind of LED?
>


-- 
Flavio de Castro Alves Filho

flavio.alves@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves

Re: Dev environment

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Tim,

Great move! Kudos!

I'm also not a GUI guy, I already used the Insight and DDD interfaces with GDB.

You can find other options here:
http://sourceware.org/gdb/wiki/GDB%20Front%20Ends

BR,

Alan

On 5/21/21, Tim <Ti...@jti.uk.com.invalid> wrote:
> Eventually got a Linux dev environment up and running (first PC purchased
> failed after a few hours...grrr...now have an Intel i5 NUC for this).
> Amazed how darn fast compilation is compared to WSL (even on my 3.3GHz
> Zeon-based workstation with the -j6 make option) so that in itself means it
> was a great move! Always liked Linux anyway lol.
>
> Eclipse (latest version) still not playing ball - just won't debug. So I'm
> assuming a platform independent setup issue with it; aka finger trouble :(
>
> I am temporarily using Segger Ozone - worked first time and can finally
> debug. Not sure I like it but hey ho.
>
> As an aside, has anyone got a recommendation of a good, graphical, GDB
> debugger for Linux, that place nicely with NuttX? Not bothered about an IDE
> as such, and I'm 100% happy with building via terminal, but a feature rich
> and easy to use debugger that looks up the source code "thoroughly" is an
> essential.
>
> But, now I can set breakpoints, I found that lack of debug messages on the
> console was because the .config was sending them to RAM not CONSOLE, because
> that's what is in the sama5d2-xult defconfig file I based my custom config
> on.
>
> Simple explanation, but is this documented anywhere? Can't find that level
> of syslog stuff using make menuconfig?
>
> Also now, at least, I know that the board is crashing in can_hwinitialize
> when it calls can_putreg(priv, SAM_PMC_PCR, regval)...so next week's task is
> to find out what's up with this (it's not my code).
>
>>>On 5/12/21, Tim Hardisty <ti...@hardisty.co.uk> wrote:
>>>>>From: Alan Carvalho de Assis <ac...@gmail.com>
>>>>>
>>>>>Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
>>>>>
>>>>>  │     -> Build Setup
>>>>>               │
>>>>>  │       -> Debug Options
>>>>>               │
>>>>>  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
>>>>>               │
>>>>>  │           -> CAN Debug Features (DEBUG_CAN [=y])
>>>>>
>>>>
>>>> Indeed I did. And, anyway, even if I hadn't my debug message might
>>>> appear but the system would keep running, but it doesn't: it crashes.
>>>> I have inserted the while(1) to narrow it down to where it
>>>> crashes....it is the call to that debug message that does it :(
>>>>
>>>
>>>Try to put a sam_piowrite(PIO_LED_YOURLED, true/false); to between the
>>>caninfo() and the while(1); just for a double check ;-)
>>>
>>>By PIO_LED_YOURLED I mean the LED that is turning ON when your board
>>>initializes.
>>>
>>>Talking about LEDs... other important thing: normally when NuttX
>>>crashes the board LED start to blink to indicate an issue, is it blinking
>>> on your
>>board?
>>
>>This is a custom board, and no LED such as that. I have removed any LED-
>>related stuff from the board.h file...is that the issue? Maybe NuttX
>> absolutely
>>depends on some kind of LED?
>
>

RE: Dev environment

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
Eventually got a Linux dev environment up and running (first PC purchased failed after a few hours...grrr...now have an Intel i5 NUC for this).  Amazed how darn fast compilation is compared to WSL (even on my 3.3GHz Zeon-based workstation with the -j6 make option) so that in itself means it was a great move! Always liked Linux anyway lol.

Eclipse (latest version) still not playing ball - just won't debug. So I'm assuming a platform independent setup issue with it; aka finger trouble :(

I am temporarily using Segger Ozone - worked first time and can finally debug. Not sure I like it but hey ho.

As an aside, has anyone got a recommendation of a good, graphical, GDB debugger for Linux, that place nicely with NuttX? Not bothered about an IDE as such, and I'm 100% happy with building via terminal, but a feature rich and easy to use debugger that looks up the source code "thoroughly" is an essential.

But, now I can set breakpoints, I found that lack of debug messages on the console was because the .config was sending them to RAM not CONSOLE, because that's what is in the sama5d2-xult defconfig file I based my custom config on.

Simple explanation, but is this documented anywhere? Can't find that level of syslog stuff using make menuconfig?

Also now, at least, I know that the board is crashing in can_hwinitialize when it calls can_putreg(priv, SAM_PMC_PCR, regval)...so next week's task is to find out what's up with this (it's not my code).

>>On 5/12/21, Tim Hardisty <ti...@hardisty.co.uk> wrote:
>>>>From: Alan Carvalho de Assis <ac...@gmail.com>
>>>>
>>>>Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
>>>>
>>>>  │     -> Build Setup
>>>>               │
>>>>  │       -> Debug Options
>>>>               │
>>>>  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
>>>>               │
>>>>  │           -> CAN Debug Features (DEBUG_CAN [=y])
>>>>
>>>
>>> Indeed I did. And, anyway, even if I hadn't my debug message might
>>> appear but the system would keep running, but it doesn't: it crashes.
>>> I have inserted the while(1) to narrow it down to where it
>>> crashes....it is the call to that debug message that does it :(
>>>
>>
>>Try to put a sam_piowrite(PIO_LED_YOURLED, true/false); to between the
>>caninfo() and the while(1); just for a double check ;-)
>>
>>By PIO_LED_YOURLED I mean the LED that is turning ON when your board
>>initializes.
>>
>>Talking about LEDs... other important thing: normally when NuttX
>>crashes the board LED start to blink to indicate an issue, is it blinking on your
>board?
>
>This is a custom board, and no LED such as that. I have removed any LED-
>related stuff from the board.h file...is that the issue? Maybe NuttX absolutely
>depends on some kind of LED?


RE: Dev environment

Posted by Tim Hardisty <ti...@hardisty.co.uk>.
>On 5/12/21, Tim Hardisty <ti...@hardisty.co.uk> wrote:
>>>From: Alan Carvalho de Assis <ac...@gmail.com>
>>>
>>>Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
>>>
>>>  │     -> Build Setup
>>>               │
>>>  │       -> Debug Options
>>>               │
>>>  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
>>>               │
>>>  │           -> CAN Debug Features (DEBUG_CAN [=y])
>>>
>>
>> Indeed I did. And, anyway, even if I hadn't my debug message might
>> appear but the system would keep running, but it doesn't: it crashes.
>> I have inserted the while(1) to narrow it down to where it
>> crashes....it is the call to that debug message that does it :(
>>
>
>Try to put a sam_piowrite(PIO_LED_YOURLED, true/false); to between the
>caninfo() and the while(1); just for a double check ;-)
>
>By PIO_LED_YOURLED I mean the LED that is turning ON when your board
>initializes.
>
>Talking about LEDs... other important thing: normally when NuttX crashes the
>board LED start to blink to indicate an issue, is it blinking on your board?

This is a custom board, and no LED such as that. I have removed any LED-related stuff from the board.h file...is that the issue? Maybe NuttX absolutely depends on some kind of LED?

Re: Dev environment

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Tim,

On 5/12/21, Tim Hardisty <ti...@hardisty.co.uk> wrote:
>>From: Alan Carvalho de Assis <ac...@gmail.com>
>>
>>Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
>>
>>  │     -> Build Setup
>>               │
>>  │       -> Debug Options
>>               │
>>  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
>>               │
>>  │           -> CAN Debug Features (DEBUG_CAN [=y])
>>
>
> Indeed I did. And, anyway, even if I hadn't my debug message might appear
> but the system would keep running, but it doesn't: it crashes. I have
> inserted the while(1) to narrow it down to where it crashes....it is the
> call to that debug message that does it :(
>

Try to put a sam_piowrite(PIO_LED_YOURLED, true/false); to between the
caninfo() and the while(1); just for a double check ;-)

By PIO_LED_YOURLED I mean the LED that is turning ON when your board
initializes.

Talking about LEDs... other important thing: normally when NuttX
crashes the board LED start to blink to indicate an issue, is it
blinking on your board?

BR,

Alan

RE: Dev environment

Posted by Tim Hardisty <ti...@hardisty.co.uk>.
>From: Alan Carvalho de Assis <ac...@gmail.com>
>
>Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?
>
>  │     -> Build Setup
>               │
>  │       -> Debug Options
>               │
>  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
>               │
>  │           -> CAN Debug Features (DEBUG_CAN [=y])
>

Indeed I did. And, anyway, even if I hadn't my debug message might appear but the system would keep running, but it doesn't: it crashes. I have inserted the while(1) to narrow it down to where it crashes....it is the call to that debug message that does it :(

Re: Dev environment

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Did you enable CONFIG_DEBUG_CAN_INFO in your menuconfig?

  │     -> Build Setup
               │
  │       -> Debug Options
               │
  │         -> Enable Debug Features (DEBUG_FEATURES [=y])
               │
  │           -> CAN Debug Features (DEBUG_CAN [=y])

BR,

Alan

On 5/12/21, Tim <Ti...@jti.uk.com.invalid> wrote:
>>From: Gregory Nutt <sp...@gmail.com>
>>Sent: 11 May 2021 18:33
>>
>>> All this starts from the CAN init code crashing (SAMA5D27) when it
>>> makes any call to print debug messages. Printf itself is fine.
>>These kinds of crashes are often due to stack overrun.  It might be worth
>>increasing the stack size of the task that calls CAN init.
>
>
> I have only just had a moment to take another look. This is the basic nsh
> config, with just the CAN example enabled. Heap size is the standard 2048,
> but if I increase to 4096 it still crashes in the same place:
>
> int sam_can_setup(void)
> {
> #if defined(CONFIG_CAN)
> 	
> 	int ret;
>   printf("PRINTF: Setting up CAN\n");
>   #if defined CONFIG_DEBUG_CAN_INFO
>
>   caninfo("CANINFO: Setting up CAN\n");
>   while(1);
>  ...etc
>
> I get the printf text on the console but not the caninfo message. The
> program is stopped in the while(1) loop. I still can't debug this, but
> that's a different problem. If I use the Eclipse debugger to pause the
> program it clearly states it has a thread for sam_can_setup() at sam_can.c
> and is trying to find the source but Eclipse reports:
>
> Can't find a source file at
> "/home/timh/nuttx/nuttx/boards/arm/sama5/jti-toucan2/src/sam_can.c"
> Locate the file or edit the source lookup path to include its location.
>
> That is not the full path from a Windows POV which is quite possible the
> issue - Windows knows the path as:
>
> C:\Users\TimHardisty\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWi
> ndows_79rhkp1fndgsc\LocalState\rootfs\home\timh\nuttx\nuttx\boards\arm\sama5
> \jti-toucan2\src
>
> I have made sure that is the path configured in Eclipse, but it seems not
> to
> respect that.
>
> If you or anyone has other suggestions (and I will reply to the suggestions
> others made in a moment) then I will give anything ago but I am currently
> investigating either a 3rd machine to just run Ubuntu or a VM on my Win10
> machine or dual booting my Mac. But, quite probably, buying a machine is a
> better bang for the buck, for me as a professional engineer, rather than
> spending time playing around with VMs or other "tricks" that might work but
> suck up time! If a £500 mini PC sorts it, then on reflection I'll be a
> happy
> chappy!
>
>

RE: Dev environment

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
>From: Gregory Nutt <sp...@gmail.com>
>Sent: 11 May 2021 18:33
>
>> All this starts from the CAN init code crashing (SAMA5D27) when it
>> makes any call to print debug messages. Printf itself is fine.
>These kinds of crashes are often due to stack overrun.  It might be worth
>increasing the stack size of the task that calls CAN init.


I have only just had a moment to take another look. This is the basic nsh
config, with just the CAN example enabled. Heap size is the standard 2048,
but if I increase to 4096 it still crashes in the same place:

int sam_can_setup(void)
{
#if defined(CONFIG_CAN) 
	
	int ret;
  printf("PRINTF: Setting up CAN\n");
  #if defined CONFIG_DEBUG_CAN_INFO
  
  caninfo("CANINFO: Setting up CAN\n");
  while(1);
 ...etc

I get the printf text on the console but not the caninfo message. The
program is stopped in the while(1) loop. I still can't debug this, but
that's a different problem. If I use the Eclipse debugger to pause the
program it clearly states it has a thread for sam_can_setup() at sam_can.c
and is trying to find the source but Eclipse reports:

Can't find a source file at
"/home/timh/nuttx/nuttx/boards/arm/sama5/jti-toucan2/src/sam_can.c" 
Locate the file or edit the source lookup path to include its location.

That is not the full path from a Windows POV which is quite possible the
issue - Windows knows the path as:

C:\Users\TimHardisty\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWi
ndows_79rhkp1fndgsc\LocalState\rootfs\home\timh\nuttx\nuttx\boards\arm\sama5
\jti-toucan2\src

I have made sure that is the path configured in Eclipse, but it seems not to
respect that.

If you or anyone has other suggestions (and I will reply to the suggestions
others made in a moment) then I will give anything ago but I am currently
investigating either a 3rd machine to just run Ubuntu or a VM on my Win10
machine or dual booting my Mac. But, quite probably, buying a machine is a
better bang for the buck, for me as a professional engineer, rather than
spending time playing around with VMs or other "tricks" that might work but
suck up time! If a £500 mini PC sorts it, then on reflection I'll be a happy
chappy!


Re: Dev environment

Posted by Gregory Nutt <sp...@gmail.com>.
> All this starts from the CAN init code crashing (SAMA5D27) when it makes any
> call to print debug messages. Printf itself is fine.
These kinds of crashes are often due to stack overrun.  It might be 
worth increasing the stack size of the task that calls CAN init.
> Has anyone got NuttX to successfully compile, and allow debug, under either
> MAC or Windows. At all? Ever?
This SAMA5Dx support was developed on Windows under Cygwin using the ARM 
embedded toolchain: 
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm


Re: Dev environment

Posted by Flavio Castro Alves Filho <fl...@gmail.com>.
Hello Tim,

I use ubuntu 20.04 server to save space :-) ... If  you use
authorized_keys in ssh ... it is even better.

For me here, the USB in the VM is more stable than in my Windows host
:-\ ... for the J-Link and also for the FTDI to see syslog.

In VS-Code, I use these extensions:
* marus25.cortex-debug-dp-stm32f4
* marus25.cortex-debug

And here is my launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit:
https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "cortex-debug",
            "request": "launch",
            "servertype": "jlink",
            "cwd": "${workspaceRoot}",
            "serverpath": "JLinkGDBServerCLExe",
            "executable": "${workspaceRoot}/build/phigw.elf",
            "name": "Debug PhiGW",
            "device": "STM32F417VE",
            "interface": "swd",
            "runToMain": true,
            "jlinkscript": "${workspaceRoot}/jlink/phigw.jlink",
            "svdFile": "${workspaceRoot}/jlink/STM32F407.svd"
        }
    ]
}

And here is my jlink script:

device STM32F417VE
si 1
speed 4000
loadbin build/phigw.bin, 0x08008000
r
g
q

Hope it helps.

Best regards,

Flavio

Em ter., 11 de mai. de 2021 às 14:36, Tim Hardisty
<Ti...@jti.uk.com.invalid> escreveu:
>
> Thanks Flavio - I hadn't thought about using a VM; that would avoid yet another lump of PC hardware cluttering up the place if I can't get the WSL or MAC approach to work.
>
> I am really hating Window at the moment (1 machine can connect to my Mac, the other can't...many hours wasted NOT fixing it!) and I had thought it time to jump ship to Mac...but Linux seems even more appealing right now!!
>
> On 11/05/2021, 18:24, "Flavio Castro Alves Filho" <fl...@gmail.com> wrote:
>
>     Hello Tim,
>
>     What I do here to implement a NuttX application is to use an Ubuntu
>     Server VM (in my case, VMWare).
>
>     In this VM, I map my Jlink (which is a nucleo board with changed
>     firmware). I use Segger tools to load the firmware.
>
>     To code, I use VSCode in Windows with SSH access to the VM (I set a
>     host-only network).
>
>     For the toolchain, I use x-pack arm-gcc. The toolchain provided by
>     ubuntu does not provide gdb.
>
>     You can use the VSCode extension with GDB and JLink to run.
>
>     Hope it helps.
>
>     Best regards,
>
>     Flavio
>
>
>
>
>


-- 
Flavio de Castro Alves Filho

flavio.alves@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves

Re: Dev environment

Posted by Tim Hardisty <Ti...@JTi.uk.com.INVALID>.
Thanks Flavio - I hadn't thought about using a VM; that would avoid yet another lump of PC hardware cluttering up the place if I can't get the WSL or MAC approach to work.

I am really hating Window at the moment (1 machine can connect to my Mac, the other can't...many hours wasted NOT fixing it!) and I had thought it time to jump ship to Mac...but Linux seems even more appealing right now!!

On 11/05/2021, 18:24, "Flavio Castro Alves Filho" <fl...@gmail.com> wrote:

    Hello Tim,

    What I do here to implement a NuttX application is to use an Ubuntu
    Server VM (in my case, VMWare).

    In this VM, I map my Jlink (which is a nucleo board with changed
    firmware). I use Segger tools to load the firmware.

    To code, I use VSCode in Windows with SSH access to the VM (I set a
    host-only network).

    For the toolchain, I use x-pack arm-gcc. The toolchain provided by
    ubuntu does not provide gdb.

    You can use the VSCode extension with GDB and JLink to run.

    Hope it helps.

    Best regards,

    Flavio

    




Re: Dev environment

Posted by Flavio Castro Alves Filho <fl...@gmail.com>.
Hello Tim,

What I do here to implement a NuttX application is to use an Ubuntu
Server VM (in my case, VMWare).

In this VM, I map my Jlink (which is a nucleo board with changed
firmware). I use Segger tools to load the firmware.

To code, I use VSCode in Windows with SSH access to the VM (I set a
host-only network).

For the toolchain, I use x-pack arm-gcc. The toolchain provided by
ubuntu does not provide gdb.

You can use the VSCode extension with GDB and JLink to run.

Hope it helps.

Best regards,

Flavio

Em ter., 11 de mai. de 2021 às 13:50, Disruptive Solutions
<di...@gmail.com> escreveu:
>
> Tim. Maybe I can try to help you concerning this matter. How can we
> connect? Do you have telegram?
>
> Op di 11 mei 2021 6:42 p.m. schreef Tim <Ti...@jti.uk.com.invalid>:
>
> > Pulling my hair out here!! So apologies for the lengthy brain dump and plea
> > for help!
> >
> >
> >
> > All this starts from the CAN init code crashing (SAMA5D27) when it makes
> > any
> > call to print debug messages. Printf itself is fine.
> >
> >
> >
> > I need to debug it. I will need to get to that point regardless.
> >
> >
> >
> > The only way I can actually get Nuttx to build is using WSL - compiles no
> > problem at all. I have a MAC - it won't compile without errors and there's
> > not enough info (for me) to see what the error is - some complaint about
> > ./builtin_list.c
> >
> >
> >
> > Mac is the machine I know least. I have no "full" Linux machine. No
> > experience of Cygwin and its ilk - just a minefield to me.
> >
> >
> >
> > I know Windows best, and have successfully used eclipse under Windows for
> > Arm development for many years (sometimes compiling within eclipse,
> > sometimes from a command prompt). But although I can download and run code
> > via my jlink, eclipse will not correctly index the source code so I cannot
> > debug or set breakpoints.
> >
> >
> >
> > So I went back to trying to get it to compile under the Mac but no joy so
> > not even got as far as seeing if eclipse - or any other debugger- will run
> > and do its job. Eclipse is pointing at the source code properly and even if
> > I stop the program and manually point the eclipse debugger to the source
> > code - where I have inserted a while(1); - it completely refuses to pick up
> > the source code. I am suspected a "\" vs "/" issue or something dumb. This
> > is true either for a project pointing to a clone in the WSL location or in
> > a
> > more native windows location
> >
> >
> >
> > I have not succeeded in getting Nuttx to build via eclipse (in Windows)
> > either - although my "Bare Metal"  SAMA5 code compiles just fine with the
> > eclipse GNU cross compilers and debugs nicely.
> >
> >
> >
> > I thought maybe I could run an X-windows emulator on my Win 10 machine and
> > run eclipse on WSL...but it doesn't get very far and just throws errors.
> >
> >
> >
> > Thought I'd try Visual GDB - no SAMA5D2 support it seems. Tried to run
> > OpenOCD (which purported to be "Windows ready") but it doesn't run.
> >
> >
> >
> > Has anyone got NuttX to successfully compile, and allow debug, under either
> > MAC or Windows. At all? Ever?
> >
> >
> >
> > If someone has any pointers I will be extremely grateful, as this is doing
> > my head in. I really don't want to waste yet more days finding a machine to
> > build up exclusively for Linux unless I REALLY have to!!!
> >
> >



-- 
Flavio de Castro Alves Filho

flavio.alves@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves

Re: Dev environment

Posted by Disruptive Solutions <di...@gmail.com>.
Tim. Maybe I can try to help you concerning this matter. How can we
connect? Do you have telegram?

Op di 11 mei 2021 6:42 p.m. schreef Tim <Ti...@jti.uk.com.invalid>:

> Pulling my hair out here!! So apologies for the lengthy brain dump and plea
> for help!
>
>
>
> All this starts from the CAN init code crashing (SAMA5D27) when it makes
> any
> call to print debug messages. Printf itself is fine.
>
>
>
> I need to debug it. I will need to get to that point regardless.
>
>
>
> The only way I can actually get Nuttx to build is using WSL - compiles no
> problem at all. I have a MAC - it won't compile without errors and there's
> not enough info (for me) to see what the error is - some complaint about
> ./builtin_list.c
>
>
>
> Mac is the machine I know least. I have no "full" Linux machine. No
> experience of Cygwin and its ilk - just a minefield to me.
>
>
>
> I know Windows best, and have successfully used eclipse under Windows for
> Arm development for many years (sometimes compiling within eclipse,
> sometimes from a command prompt). But although I can download and run code
> via my jlink, eclipse will not correctly index the source code so I cannot
> debug or set breakpoints.
>
>
>
> So I went back to trying to get it to compile under the Mac but no joy so
> not even got as far as seeing if eclipse - or any other debugger- will run
> and do its job. Eclipse is pointing at the source code properly and even if
> I stop the program and manually point the eclipse debugger to the source
> code - where I have inserted a while(1); - it completely refuses to pick up
> the source code. I am suspected a "\" vs "/" issue or something dumb. This
> is true either for a project pointing to a clone in the WSL location or in
> a
> more native windows location
>
>
>
> I have not succeeded in getting Nuttx to build via eclipse (in Windows)
> either - although my "Bare Metal"  SAMA5 code compiles just fine with the
> eclipse GNU cross compilers and debugs nicely.
>
>
>
> I thought maybe I could run an X-windows emulator on my Win 10 machine and
> run eclipse on WSL...but it doesn't get very far and just throws errors.
>
>
>
> Thought I'd try Visual GDB - no SAMA5D2 support it seems. Tried to run
> OpenOCD (which purported to be "Windows ready") but it doesn't run.
>
>
>
> Has anyone got NuttX to successfully compile, and allow debug, under either
> MAC or Windows. At all? Ever?
>
>
>
> If someone has any pointers I will be extremely grateful, as this is doing
> my head in. I really don't want to waste yet more days finding a machine to
> build up exclusively for Linux unless I REALLY have to!!!
>
>