Avatar for Robin

Robin

Member since Jan 2017 • Last active Dec 2021

Most recent activity

  • Avatar for Robin

    While I'm searching for a suitable gdb tutorial or suggested command line instruction set,

    I have made a bit of progress with attaching the gdb process, but I'm not sure this is going to get me to setting breakpoints within the .c source, similar to how one might debug a Visual Studio C#/C/CPP project.

    From the web page content, link post #1, my mental model is that the .c source seen within the VSCode app would be the launch point to start a main.c file there. Several failed attempts at tasks.json and launch.json
    left me a bit bewildered, and had gotten to the hardware debug stage with SEGGER and SWD. This still seems to be the subsequent next step, before gaining the experience debugging with the Espruino Linux executable, which should be first, shouldn't it?


    For example, should I need to set a BP at (inside fcn):

    L958 jshardware.c
    JsSysTime jshGetSystemTime()

    what is the process to get from Javascript instruction

    https://www.espruino.com/Reference#l__glĀ­obal_getTime

    presumeably run from the Espruino Linux exectuable running inside the VSCode Terminal, through to the call

    jswrap_interactive.c#L362 on to the call to jshGetSystemTime()



    Still seeking the solution there, maybe sample tasks.json and launch.json are needed, but in the meantime:

    Entry point: 0x26554
            0x00026000 - 0x0006ace0 is .text
            0x0006ace0 - 0x0006ad10 is .sdh_ble_observers
            0x0006ad10 - 0x0006ad30 is .sdh_soc_observers
            0x0006ad30 - 0x0006ad50 is .sdh_state_observers
            0x0006ad50 - 0x0006ad60 is .sdh_stack_observers
            0x0006ad60 - 0x0006ad68 is .sdh_req_observers
            0x0006ad68 - 0x0006ad7c is .nrf_queue
            0x0006ad7c - 0x0006ad84 is .ARM.exidx
            0x20003720 - 0x200039a0 is .data
            0x200039a0 - 0x200039b4 is .fs_data
            0x2003fff0 - 0x20040000 is .noinit
            0x200039b8 - 0x200332d0 is .bss
    (gdb) nexti
    0x000140d4 in ?? ()
    (gdb) nexti
    0x000140d6 in ?? ()
    (gdb) nexti
    0x000140d8 in ?? ()
    


    https://www.gnu.org/software/gdb/documenĀ­tation/

    Although I'm not entirely certain at how to interpret the above, it appears the .elf file is being decoded and it appears the instruction(s) is being stepped into, until I learn the gdb commands, am I on the right path to get at the source? The above seems more of a hardware register debug process.

  • Avatar for Robin

    Sun 2021.11.21

    Goal is to debug within the Espruino Linux executable.

    Last code snippet on the AdvancedDebug page produces the above error.



    Following the 'Advanced Debug' instructions at:

    https://www.espruino.com/AdvancedDebug

    'we'd strongly suggest you try and debug a normal Linux executable of Espruino first'

    Fixed Under 'Gothchas'
    Removed the reference: ''bootloader' : 1' from the board file
    Ran make using DEBUG=1



    What does work:
    The Espruino Linux executable is built along with espruino_2v08.220_pico_1r3.bin and .lst

    It is possible to execute Javascript statements within the Terminal window, with the console like emulation, thus debugging Javascript is possible, but the goal is to debug setting breakpoints within that .c source Linux executable.



    From the last snippet window on the AdvancedDebug page:

    DEBUG=1 PICO_1V3=1 make gdb

    produces error: make: *** No rule to make target 'gdb'. Stop.



    Reviewing the makefile file, around L700 is a single reference to gdb: export GDB=$(CCPREFIX)gdb
    Reviewing the make files within the folder \make doesn't reveal a gdb make target file.

    I tried the second to last snippet:
    DEBUG=1 PICO_1V3=1 make flash
    make/sanitycheck.make:16: *** You now need to build with 'BOARD=PICO_R1_3 make'. Stop.

    which produces an apparent modification that needs attention.

    I did locate this sanity check, and attempted to follow the established pattern.

    From sanitycheck.make, references indicate to use the 'BOARD=' prefix, so tried that:

    DEBUG=1 BOARD=PICO_R1_3 make gdb

    but without success. Is there a missing gdb make file that is needed here? Is there a gdb entry point that needs to be included, maybe in a separate make routine or file?



    Back to trying this @fanoush arm-none-eabi-gdb suggestion:

    post #3 last pp. Conceptual comments needed on simple firmware debug

  • in JavaScript
    Avatar for Robin

    'What else is empowered to remove spaces?'

    Maybe we are splitting hairs here, but doesn't a parser read the user command and break up into the individual pieces without spaces that are processed in order to determine the command syntax for execution? As I understand the process of minification reduces each part to it's simplest representation, the examples in post #1 are already minified as best they can be aren't they?

    Should one remove that whitespace, syntax errors occur and the editor points this out with a red 'Bad assignment' error.

    When uploaded:

    Uncaught SyntaxError: Got ')' expected EOF
     at line 1 col 21
    x = () => print(2 --1);
    



    and this syntax without the space is parsed and executes just fine:

    z = () => print(1 -(-1));
    
    =function (undefined) { ... }
    >z()
    2
    =undefined
    



    In any event, as I don't receive the errors that are indicated in post #1 using the emulator, I'm wondering what the differences are in browser and PC environment by comparison.

    As an end user like yourself, I've just gotten running and are working through the Advanced Debug documentation and this would be a good sample to use to locate the problematic area.

    https://www.espruino.com/AdvancedDebug

    Am willing to put in the time to learn, but haven't grasped how to set up the environment to get started, even after following the 'Gotchas' section.

  • in Porting to new Devices
    Avatar for Robin

    'Thank you @Robin! I've only invested a little time so far, I assumed that sample code I had would work!'

    While I won't let the thanks of gratitude inflate my ego, shouldn't the credit go to fanoush instead?

    P.S. the sundial response was a hoot!!

  • in JavaScript
    Avatar for Robin

    Tue 2021.11.02

    Title: 'Minification bug: erroneous fusion of operator symbols'

    I feel this is more of a parsing issue, rather than a minification issue.

    Now I find this very interesting. I first tried using a trusted flashed device 2V08.220 and the native app.

    On the right hand editor side, in the left hand margin a yellow warning 'Confusing minuses'

    When I upload, and execute function x(), I concur with the same error message.

    Uncaught Error: Unable to assign value to non-reference Number
     at line 1 col 8
    print(1--1)
    

    Using parenthesis and modifying as follows:

    x = () => print(1 - (-1));
    

    The above executes as expected as does the mod() example, but with no error(s):

    >x = () => print(1 - (-1));
    =function (undefined) { ... }
    >x()
    2
    =undefined
    >x => mod(x- -x, 1)
    =function (x) { ... }
    >x()
    2
    =undefined
    

    When I run the tests using the online IDE indicating the same version and using either emulator, although the original line of code does also display the orange 'Confusing minuses' warning, those upload without errors also!

    2v10.187 (c) 2021 G.Williams
    
    Found EMSCRIPTEN2, 2v10.187
    Connected to Emulator
    
    >dump()
    =undefined
    >x = () => print(1 - -1);
    =function (undefined) { ... }
    >x()
    2
    =undefined
    >y = () => print(2 + -1);
    =function (undefined) { ... }
    >y()
    1
    =undefined
    >z = () => print(2 - -1);
    =function (undefined) { ... }
    >z()
    3
    =undefined
    >
    



    Wouldn't you agree that adding the parenthesis indicates a parsing issue?

    No clue why errors don't show in my environment when using the online WebIDE:

    Browser Chrome Version 94.0.4606.81 (Official Build) (64-bit) on Windows10 v20H2 19042.1288

    Maybe a few more community members can give this a whirl and report in perhaps?

Actions