ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.67k stars 2.97k forks source link

Cannot debug anymore in mbed 5.2. #3212

Closed EduardPon closed 7 years ago

EduardPon commented 7 years ago

I cannot debug anymore after switching to mbed 5.2.1. The option -o debug-info seems not to be supported anymore. How can I enable it again? Thanks.

mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 -o debug-info

make.py: error: unrecognized arguments: -o debug-info

[mbed] ERROR: "python" returned error code 2.
[mbed] ERROR: Command "python -u C:\xx\xx\xx-mbed5\mbed-os\tools\make.py -t GCC_ARM -m OUR_TARGET_K64F_IPV6 -o debug-info --so
urce . --build .\.build\OUR_TARGET_K64F_IPV6\GCC_ARM -j0" in "C:\xx\xx\xx-mbed5"

Show help shows still the -o.

optional arguments:
  -h, --help            show this help message and exit
  -t TOOLCHAIN, --toolchain TOOLCHAIN
                        Compile toolchain. Example: ARM, GCC_ARM, IAR
  -m TARGET, --target TARGET
                        Compile target MCU. Example: K64F, NUCLEO_F401RE,
                        NRF51822...
  -o OPTIONS, --options OPTIONS
                        Compile options. Examples: "debug-info": generate
                        debugging information; "small-build" to use
                        microlib/nanolib, but limit RTOS to single thread;
                        "save-asm": save the asm generated by the compiler
  --library             Compile the current program or library as a static
                        library.
  --config              Show run-time compile configuration
  --prefix CONFIG_PREFIX
                        Restrict listing to parameters that have this prefix
  --source SOURCE       Source directory. Default: . (current dir)
  --build BUILD         Build directory. Default: .build/
  -c, --clean           Clean the build directory before compiling
  -N ARTIFACT_NAME, --artifact-name ARTIFACT_NAME
                        Name of the built program or library
  -S, --supported       Shows supported matrix of targets and toolchains
  -v, --verbose         Verbose diagnostic output
  -vv, --very_verbose   Very verbose diagnostic output
bulislaw commented 7 years ago

We renamed this option to --profile PROFILE Build profile to use. Can be either path to jsonfile or one of the default one (debug, default, small) unfortunately there's a bug in mbed-cli (https://github.com/ARMmbed/mbed-cli/issues/370) displaying out of date help text which makes things harder to see. So right now you need to use --profile debug

EduardPon commented 7 years ago

How should we use this? Like this it does not work:

mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 -o debug-info --profile PROFILE

Also --profile debug returns: [ERROR] [Errno 13] Permission denied: 'debug' [mbed] ERROR: "python" returned error code 1.

bulislaw commented 7 years ago

Try mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 --profile debug or just mbed compile ...

bulislaw commented 7 years ago

If you're not using recent version of mbed-os, you'll need to put whole path to the profile file eg --profile mbed-os/tools/profiles/debug.json

EduardPon commented 7 years ago

I'm using the recent mbed-os, but the --profile debug returns the [ERROR] [Errno 13] Permission denied: 'debug'.

Adding in debug.json seems also not to work, see 2nd row:

    "GCC_ARM": {
        "common": ["-c", "-Wall", "-Wextra", "--profile", 
                   "-Wno-unused-parameter", "-Wno-missing-field-initializers",
                   "-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
                   "-ffunction-sections", "-fdata-sections", "-funsigned-char",
                   "-MMD", "-fno-delete-null-pointer-checks",
                   "-fomit-frame-pointer", "-O0", "-g"],
        "asm": ["-x", "assembler-with-cpp"],
        "c": ["-std=gnu99"],
        "cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"],
        "ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
               "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r",
               "-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit"]
    },

This is what the debugger start reports in the console window:

No symbol table is loaded.  Use the "file" command.

Temporary breakpoint 1, 0x000448e4 in main ()
No breakpoint number 4.
bulislaw commented 7 years ago

The --profile option requires a parameter either a profile name (one of debug, default, small) or a path to .json profile file. Adding --profile to debug.json file doesn't make any sense, as it's not a compiler/linker switch, it merely includes this json file with compiler options. Did you try specifying the full path to the debug.json file in your mbed compile line? eg.--profile mbed-os/tools/profiles/debug.json but you need to put a path specific to your file system, also if you're sure the path you're supplying is correct and it still complains about 'permission denied' check access rights to the debug.json file.

mbed-cli compile -j0 -t GCC_ARM -m OUR_TARGET_K64F_IPV6 --profile mbed-os/tools/profiles/debug.json assuming that the path is correct.

EduardPon commented 7 years ago

Ok, I totally forgot to use the full path. The symbol table is now generated and break points are operational again.

Thanks for help and quick response...