This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: Log_info0, etc in SimpleCentral?

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640,

I'm using simple central as a baseline for my code and would like to add the logging style of project zero. I've added all the includes, etc and have modified the project spec file as suggested in a related post.

The code compiles fine but I can't get the logging to actually print out on putty. I don't think it's a hardware / PC issue because if I load project zero on the same setup, logging is fine.

I can't help but think I'm missing a file or not checking a box somethere.

Jason

  • Hi Jason,

    It looks like you haven't modify the .cfg file.
    Please review this thread.
    Let us know if you have more questions.

    Best regards,

  • In the post you referenced there is a line "assuming blestack not ble5stack". Unfortunately, I am using BLE5 stack. Is there a different set of instructions>

    Regards,

    Jason

  • Hi Jason,

    It should be almost the same procedure for all the stacks.

    You can leverage the project_zero example for additional inputs.

    Regards,

  • I looked at project zero and copied what I figured was important. Can you give me an idea of what files are particularly worth looking at? You mentioned the .cfg file in the post above. Which .cfg file in particular?

  • Got it. It was the cfg file under the C:\ti\simplelink_cc2640r2_sdk_4_40_00_10\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_central\tirtos. It didn't have the line "
    Idle.addFunc('&uartLog_flush');"

    Thanks for the help.

  • Sorry, spoke too soon. Didn't actually work.

    What I've do

    Sorry, spoke too soon. Didn't actually work.

    What I've done is modify the cfg file above with the flush line, added all the Uart includes that project zero used. Added a include path to project zeros uart includes and modified the spec file as suggested. None of it seems to work. 

    Any other suggestions?

    When I step through the code the uart configure lines in main.c seem valid (they step to places) but the actual call to Log_info0 in the main application file does nothing. It just gets skipped.

    Any idea why?

    Thanks,

    Jason

  • Hi Jason,

    If you modify the file in your file explorer, you should re-import the project (if not the modification will not impact the build). I rather suggest to modify the .cfg in the CCS project (using the CCS IDE).

    Here is a checklist:

    • add the following code in <Project>/TOOLS/app_ble.cfg (after the line utils.importFile("common/cc26xx/kernel/cc2640/config/cc2640_r2_csdk.cfg");)
      /* Print out log statements */
      Idle.addFunc('&uartLog_flush');
    • add the following pre-define
      uartlog_FILE="\"${InputFileName}\""
      UARTLOG_ENABLE

    • Add to main: #include <uartlog/UartLog.h> (or however you have the include path set up)
    • Add to main function after PIN_init
      • UART_init();
      • UartLog_init(UART_open(Board_UART0, NULL));
    • Add to simple_central.c
      • #include <uartlog/UartLog.h>
      • Somewhere in the task function, add Log_info0("This seems to work");\

    I hope this will help,

    Regards,

  • I modified TOOLS/app_ble.cfg as follows:

    utils.importFile("common/cc26xx/kernel/cc2640/config/cc2640_r2_csdk.cfg");
    /* Print out log statements */
    Idle.addFunc('&uartLog_flush');
    uartlog_FILE="\"${InputFileName}\""
    UARTLOG_ENABLE
    /*
    * Extend the cc2640 configuration
    */

    /* If you want to ease the TI-RTOS/application debug, you may want to disable the following option.
    * If you enable assert, be sure you have xdc_runtime_Assert_DISABLE_ALL NOT define in your project option */
    //Error.policyFxn = Error.policyDefault;
    //BIOS.assertsEnabled = true;


    /* Heap Configuration defines the type of Heap you want to use for the system (application + Stack)
    * Only one Heap buffer will be allocated. This heap will be shared by the system and the stack through one manager (HeapMem, HeapMem+HeapTrack or OSAL)
    * You can still decide to create several heaps if you want, but at least one heap needs to be created.
    * The stack must have a Heap to run.
    * The different Heap manager available are :
    * OSAL HEAP: legacy Heap manager provided with all BLE sdk. By default, this Heap manager is used.
    * HeapMem:  heap manager provided by TI-RTOS (see TI-RTOS user guide for properties)
    * HeapTrack: module on top of HeapMem allowing an easy debugging of memory allocated through HeapMem.

    * The heap manager to use is selected by setting HEAPMGR_CONFIG to the corresponding value (see below)
    * 0 = osal Heap manager, size is static.
    * 0x80 = osal Heap manager, with auto-size: The remainning RAM (not used by the system) will be fully assign to the Heap.
    * 1 = HeapMem with Static size
    * 0x81 = HeapMem with auto-size. The remainning RAM (not used by the system) will be fully assign to the Heap.
    * 2 = HeapTrack (with HeapMem) with fixe size
    * 0x82 = HeapTrack (with HeapMem) with auto-size: The remainning RAM (not used by the system) will be fully assign to the Heap.
    *
    * If HEAPMGR_CONFIG is not defined, but the configuration file ble_stack_heap.cfg is used, then the value HEAPMGR_CONFIG = 0x80 is assumed.
    * If HEAPMGR_CONFIG is not defined, and the file ble_stack_heap.cfg is not used, then the value HEAPMGR_CONFIG = 0x80 is assumed and the default Heap size will be 3072
    * unless you define HEAPMGR_SIZE to a different value in the project option (0 meaning auto-size).
    *
    * From the configuration below, two #define will be created that will be used by the application to setup the Heap:
    * #define HEAPMGR_SIZE
    * #define HEAPMGR_CONFIG
    * In order to use those define, this include line needs to be added: #include <xdc/cfg/global.h>
    *
    * In order for the auto-size Heap to work, the following symbol needs to be created by the linker:
    * heapStart
    * heapEnd
    *
    */
    /* modification of HEAPMGR_CONFIG and HEAPMGR_SIZE value must be done inside the include file bellow (ble_stack_jheap.cfg) */
    utils.importFile("common/cc26xx/kernel/cc2640/config/ble_stack_heap.cfg");

    --------------------------------------------------------------END OF FILE-------------------------------------------------------

    The results were a weird error.

    Invoking: XDCtools
    "C:/ti/xdctools_3_51_01_18_core/xs" --xdcpath="C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source;C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/kernel/tirtos/packages;C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M3 -p ti.platforms.simplelink:CC2640R2F -r release -c "C:/ti/ti-cgt-arm_18.12.5.LTS" --compileOptions "-mv7M3 --code_state=16 -me -O4 --opt_for_speed=0 --include_path=\"C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app\" --include_path=\"C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app/Application\" --include_path=\"C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app/Startup\" --include_path=\"C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app/PROFILES\" --include_path=\"C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app/Include\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/controller/cc26xx/inc\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/inc\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/rom\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/common/cc26xx\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/icall/inc\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/target\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/hal/src/target/_common\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/hal/src/target/_common/cc26xx\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/hal/src/inc\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/heapmgr\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/icall/src/inc\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/osal/src/inc\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/services/src/saddr\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/ble5stack/services/src/sdata\" --include_path=\"C:/ti/simplelink_cc2640r2_sdk_4_40_00_10/source/ti/devices/cc26x0r2\" --include_path=\"C:/ti/ti-cgt-arm_18.12.5.LTS/include\" --define=DeviceFamily_CC26X0R2 -g --c99 --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi " "../TOOLS/app_ble.cfg"
    configuring app_ble.xem3 from package/cfg/app_ble_pem3.cfg ...
    TOOLS/subdir_rules.mk:12: recipe for target 'build-1103652863-inproc' failed
    js: "C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app/TOOLS/app_ble.cfg", line 5: ReferenceError: "UARTLOG_ENABLE" is not defined. (C:/Users/herr_/CCS_Software_Work/BeeFobCentral/SimpleCentral/ble5_simple_peripheral_cc2640r2lp_app/TOOLS/app_ble.cfg#5)
    "./package/cfg/app_ble_pem3.cfg", line 180
    xdctools_3_51_01_18_core\gmake.exe: *** [package.mak:202: package/cfg/app_ble_pem3.xdl] Error 1
    xdctools_3_51_01_18_core\gmake.exe: *** [package/cfg/app_ble_pem3.xdl] Deleting file 'package/cfg/app_ble_pem3.h'
    xdctools_3_51_01_18_core\gmake.exe: *** [package/cfg/app_ble_pem3.xdl] Deleting file 'package/cfg/app_ble_pem3.c'
    js: "C:/ti/xdctools_3_51_01_18_core/packages/xdc/tools/Cmdr.xs", line 52: Error: xdc.tools.configuro: configuration failed due to earlier errors (status = 2); 'linker.cmd' deleted.
    gmake[1]: *** [build-1103652863-inproc] Error 1
    gmake: *** [build-1103652863] Error 2
    TOOLS/subdir_rules.mk:9: recipe for target 'build-1103652863' failed
    gmake: Target 'all' not remade because of errors.

  • Hi,

    The following lines shoul NOT be in the .cfg file.

    uartlog_FILE="\"${InputFileName}\""
    UARTLOG_ENABLE

    The two symbols should be added to the predefined symbols. Pre-defined symbols should be modified by right click on the project > Properties > Build > Arm Compiler > Predefined Symbols

    Regards,

  • Merci beaucoup!

    Got it to work. Thanks for all the help.

    Jason

  • One more question... I upgraded to Simplelink 4_40_00_10 and the logging stopped working. Any ideas?

    I still have implemented the fixes from above but the Log_info just prints out one line and hangs. I remember something about a spec file in a previous post but I can't find it. Could that be it?

    It worked on the older version of Simplelink 2_40_00_32 fine before I upgraded.

    Thanks,

    Jason

  • Perhaps I didn't migrate correctly?

    To change SimpleLink versions I right clicked on both the app and the stack and went Properties->General->Products tab the double clicked on the SImplLink CC2640R2 SDK to select the newer version. Is that correct? Did I miss anything?

  • Hi,

    Could you please open a new thread to discuss this migration question? Please also review our migration guides.

    Regards,