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.
Tool/software: TI-RTOS
Hi guys,
I'm trying to add the OAD Off Chip functionality to the Project Zero example.
I've noticed differences in what the documentation specifies (software-dl.ti.com/.../oad_offchip.html versus how it was implemented in the simple_peripheral_oad_offchip example.
Some of the differences are what the documentation recommends to do in the main app:
if (events & SBP_QUEUE_PING_EVT) { while (!Queue_empty(hOadQ)) { oadTargetWrite_t *oadWriteEvt = Queue_get(hOadQ); // Identify new image. if (oadWriteEvt->event == OAD_WRITE_IDENTIFY_REQ) { OAD_imgIdentifyWrite(oadWriteEvt->connHandle, oadWriteEvt->pData); } // Write a next block request. else if (oadWriteEvt->event == OAD_WRITE_BLOCK_REQ) { OAD_imgBlockWrite(oadWriteEvt->connHandle, oadWriteEvt->pData); } // Free buffer. ICall_free(oadWriteEvt); } }
versus what the example does in simple_peripheral_oad_offchip.c:
// OAD events if(events & SBP_OAD_QUEUE_EVT) { // Process the OAD Message Queue uint8_t status = OAD_processQueue(); // If the OAD state machine encountered an error, print it // Return codes can be found in oad_constants.h if(status == OAD_DL_COMPLETE) { Display_print0(dispHandle, SBP_ROW_STATUS1, 0, "OAD DL Complete, wait for Enable"); } else if(status == OAD_IMG_ID_TIMEOUT) { Display_print0(dispHandle, SBP_ROW_STATUS1, 0, "ImgID Timeout, disconnecting"); // This may be an attack, terminate the link GAPRole_TerminateConnection(); } else if(status != OAD_SUCCESS) { Display_print1(dispHandle, SBP_ROW_STATUS1, 0, "OAD Error: %d", status); } } if(events & SBP_OAD_COMPLETE_EVT) { // Register for L2CAP Flow Control Events L2CAP_RegisterFlowCtrlTask(selfEntity); }
Also, what the document recommends to do to edit the linker file (for existing linker files) (http://software-dl.ti.com/simplelink/esd/simplelink_cc2640r2_sdk/1.40.00.45/exports/docs/blestack/ble_user_guide/html/oad-ble-stack-3.x/oad_appendix.html#sec-generating-oad-linker-file
/* The starting address of the application. Normally the interrupt vectors */ /* must be located at the beginning of the application. Flash is 128KB, with */ /* sector length of 4KB */ #define FLASH_APP_BASE 0x00000000 #define FLASH_LEN 0x20000 #define FLASH_PAGE_LEN 0x1000 #define FLASH_PAGE_MASK 0xFFFFF000 /* Last page of Flash is allocated to App: 0x1F000 - 0x1FFFF */ #define FLASH_LAST_PAGE_START (FLASH_LEN - FLASH_PAGE_LEN) #ifdef ICALL_STACK0_START #ifdef PAGE_ALIGN #define ADJ_ICALL_STACK0_START (ICALL_STACK0_START & FLASH_PAGE_MASK) #else /* !PAGE_ALIGN */ #define ADJ_ICALL_STACK0_START ICALL_STACK0_START #endif /* PAGE_ALIGN */ #endif /* ICALL_STACK0_START */ /* Application stored in and executes from internal flash */ /* Flash Size 128 KB */ #ifdef ICALL_STACK0_START FLASH (RX) : origin = FLASH_OAD_IMG_START, length = ADJ_ICALL_STACK0_START - FLASH_OAD_IMG_HDR_SIZE #else // default FLASH (RX) : origin = FLASH_OAD_IMG_START, length = FLASH_LEN - FLASH_PAGE_LEN - FLASH_OAD_IMG_HDR_SIZE #endif
Versus what the example simple_peripheral_oad_offchip does in cc26xx_app_oad.cmd:
/****************************************************************************** @file cc26xx_app_oad.cmd @brief CC2650F128 linker configuration file for TI-RTOS with Code Composer Studio. Imported Symbols Note: Linker defines are located in the CCS IDE project by placing them in Properties->Build->Linker->Advanced Options->Command File Preprocessing. CACHE_AS_RAM: Disable system cache to be used as GPRAM for additional volatile memory storage. CCxxxxROM: Device Name (e.g. CC2650). In order to define this symbol, the tool chain requires that it be set to a specific value, but in fact, the actual value does not matter as it is not used in the linker control file. The only way this symbol is used is based on whether it is defined or not, not its actual value. There are other linker symbols that do specifically set their value to 1 to indicate R1, and 2 to indicate R2, and these values are checked and do make a difference. However, it would appear confusing if the device name's value did not correspond to the value set in other linker symbols. In order to avoid this confusion, when the symbol is defined, it should be set to the value of the device's ROM that it corresponds so as to look and feel consistent. Please note that a device name symbol should always be defined to avoid side effects from default values that may not be correct for the device being used. ICALL_RAM0_START: RAM start of BLE stack. ICALL_STACK0_START: Flash start of BLE stack. PAGE_AlIGN: Align BLE stack boundary to a page boundary. Aligns to Flash word boundary by default. (Note: for OAD, page alignment must be used) OAD_IMG_(A,B,E) Used to designate OAD images: - A: On-chip OAD persistent application - B: On-chip OAD user application - E: Off-chip OAD application Group: CMCU, SCS Target Device: CC2640R2 ****************************************************************************** Copyright (c) 2013-2017, Texas Instruments Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************** Release Name: simplelink_cc2640r2_sdk_1_40_00_45 Release Date: 2017-07-20 17:16:59 *****************************************************************************/ /******************************************************************************* * CCS Linker configuration */ /* Retain interrupt vector table variable */ --retain=g_pfnVectors /* Override default entry point. */ --entry_point ResetISR /* Suppress warnings and errors: */ /* - 10063: Warning about entry point not being _c_int00 */ /* - 16011, 16012: 8-byte alignment errors. Observed when linking in object */ /* files compiled using Keil (ARM compiler) */ --diag_suppress=10063,16011,16012 /* The following command line options are set as part of the CCS project. */ /* If you are building using the command line, or for some reason want to */ /* define them here, you can uncomment and modify these lines as needed. */ /* If you are using CCS for building, it is probably better to make any such */ /* modifications in your CCS project and leave this file alone. */ /* */ /* --heap_size=0 */ /* --stack_size=256 */ /* --library=rtsv7M3_T_le_eabi.lib */ /******************************************************************************* * Memory Sizes */ #define FLASH_BASE 0x00000000 #define GPRAM_BASE 0x11000000 #define RAM_BASE 0x20000000 #define ROM_BASE 0x10000000 #ifdef CC26X0ROM #define FLASH_SIZE 0x00020000 #define GPRAM_SIZE 0x00002000 #define RAM_SIZE 0x00005000 #define ROM_SIZE 0x0001C000 #endif /* CC26X0ROM */ /******************************************************************************* * Memory Definitions ******************************************************************************/ /******************************************************************************* * RAM */ #ifdef CC26X0ROM #if CC26X0ROM == 2 #define RESERVED_RAM_SIZE 0x00000C00 #elif CC26X0ROM == 1 #define RESERVED_RAM_SIZE 0x00000718 #endif /* CC26X0ROM */ #endif /* CC26X0ROM */ #define RAM_START RAM_BASE #ifdef ICALL_RAM0_START #define RAM_END (ICALL_RAM0_START - 1) #else #define RAM_END (RAM_START + RAM_SIZE - RESERVED_RAM_SIZE - 1) #endif /* ICALL_RAM0_START */ /******************************************************************************* * Flash */ #define WORD_SIZE 4 #ifdef CC26X0ROM #define PAGE_SIZE 0x1000 #endif /* CC26X0ROM */ #ifdef PAGE_ALIGN #define FLASH_MEM_ALIGN PAGE_SIZE #else #define FLASH_MEM_ALIGN WORD_SIZE #endif /* PAGE_ALIGN */ #ifdef CC26X0ROM #define PAGE_MASK 0xFFFFF000 #endif /* CC26X0ROM */ /* The last Flash page is reserved for the BIM. */ #define NUM_RESERVED_FLASH_PAGES 1 #define RESERVED_FLASH_SIZE (NUM_RESERVED_FLASH_PAGES * PAGE_SIZE) #ifdef ICALL_STACK0_START #ifdef PAGE_ALIGN #define ADJ_ICALL_STACK0_START (ICALL_STACK0_START * PAGE_MASK) #else #define ADJ_ICALL_STACK0_START ICALL_STACK0_START #endif /* PAGE_ALIGN */ #endif #ifdef OAD_IMG_A #define FLASH_START 0 #define ENTRY_SIZE 0x40 #define ENTRY_END FLASH_START + FLASH_SIZE - RESERVED_FLASH_SIZE - 1 #define ENTRY_START ENTRY_END - ENTRY_SIZE + 1 #define FLASH_END ENTRY_START - 1 #else #define OAD_HDR_START 0 #define OAD_HDR_SIZE 0x50 #define OAD_HDR_END OAD_HDR_START + OAD_HDR_SIZE - 1 #define ENTRY_START OAD_HDR_END + 1 #define ENTRY_SIZE 0x40 #define ENTRY_END ENTRY_START + ENTRY_SIZE - 1 #define FLASH_START ENTRY_END + 1 #define FLASH_END ICALL_STACK0_START - 1 #endif /******************************************************************************* * Stack */ /* Create global constant that points to top of stack */ /* CCS: Change stack size under Project Properties */ __STACK_TOP = __stack + __STACK_SIZE; /******************************************************************************* * GPRAM */ #ifdef CACHE_AS_RAM #define GPRAM_START GPRAM_BASE #define GPRAM_END (GPRAM_START + GPRAM_SIZE - 1) #endif /* CACHE_AS_RAM */ /******************************************************************************* * Main arguments */ /* Allow main() to take args */ /* --args 0x8 */ /******************************************************************************* * ROV * These symbols are used by ROV2 to extend the valid memory regions on device. * Without these defines, ROV will encounter a Java exception when using an * autosized heap. This is a posted workaround for a known limitation of * RTSC/rta. See: bugs.eclipse.org/.../show_bug.cgi * * Note: these do not affect placement in RAM or FLASH, they are only used * by ROV2, see the BLE Stack User's Guide for more info on a workaround * for ROV Classic * */ __UNUSED_SRAM_start__ = 0x20000000; __UNUSED_SRAM_end__ = 0x20005000; __UNUSED_FLASH_start__ = 0; __UNUSED_FLASH_end__ = 0x1FFFF; /******************************************************************************* * System Memory Map ******************************************************************************/ MEMORY { /* EDITOR'S NOTE: * the FLASH and SRAM lengths can be changed by defining * ICALL_STACK0_START or ICALL_RAM0_START in * Properties->ARM Linker->Advanced Options->Command File Preprocessing. */ FLASH (RX) : origin = FLASH_START, length = ((FLASH_END - FLASH_START) + 1) ENTRY (RX) : origin = ENTRY_START, length = ENTRY_SIZE #ifndef OAD_IMG_A FLASH_IMG_HDR (RX) : origin = OAD_HDR_START, length = OAD_HDR_SIZE #endif #ifdef ICALL_RAM0_START SRAM (RWX) : origin = RAM_START, length = ICALL_RAM0_START - RAM_START #else SRAM (RWX) : origin = RAM_START, length = RAM_END - RAM_START + 1 #endif } /******************************************************************************* * Section Allocation in Memory ******************************************************************************/ SECTIONS { #ifdef OAD_IMG_A GROUP > FLASH(HIGH) { .image_header align PAGE_SIZE .text .const .constdata .rodata .emb_text .init_array .cinit .pinit }LOAD_END(flashEndAddr) GROUP > ENTRY { .resetVecs .intvecs EntrySection LOAD_START(prgEntryAddr) } #else // OAD_IMG_B || OAD_IMG_E GROUP > FLASH_IMG_HDR { .image_header align PAGE_SIZE } GROUP > ENTRY { .resetVecs .intvecs EntrySection LOAD_START(prgEntryAddr) } GROUP >> FLASH { .text .const .constdata .rodata .emb_text .pinit } .cinit : > FLASH LOAD_END(flashEndAddr) #endif // OAD_IMG_A GROUP > SRAM { .data LOAD_START(ramStartHere) #ifndef CACHE_AS_RAM .bss #endif /* CACHE_AS_RAM */ .vtable .vtable_ram vtable_ram .sysmem .nonretenvar } LOAD_END(heapStart) .stack : > SRAM (HIGH) LOAD_START(heapEnd) #ifdef CACHE_AS_RAM ll_bss > SRAM { --library=cc2640_ll_*.a<ll.o> (.bss) }LOAD_END(heapStart) .bss : { *(.bss) } > GPRAM #endif /* CACHE_AS_RAM */ }
So, since I've tested the simple_peripheral_oad_offchip, I'm trying to go off of that. An issue with the documented approach is I could never get the L2CAP_RegisterFlowCtrlTask(selfEntity); function to link correctly.
The problem I am facing now is that using the default cc26xx_app_oad.cmd when I build the project I get the error:
This could be because simple_peripheral_cc2640r2lp_oad_offchip_app is a separate stack and app image whereas the project zero is a library image.
So, I'm just a bit confused on which to follow: the documentation or the example. I haven't had luck with either yet. Is there a different example you could point me to? Or any suggestions?
I've uploaded my project if you would like to take a look. (Please note some references are pointing to my E: drive where I had also installed the SDK 1.40.00.45.
Thanks again for your time,
Regards,
Brett
Hi Brett,
The BLE-Stack v3.1.0 does not provide examples of stack library OAD or how to add it to an application. I would recommend you follow the steps in the Converting Library Build to Split Image chapter of the BLE-Stack User's Guide and then use the Simple Peripheral Off-chip example to add OAD to the project.
Hi Rachel,
Thank you for the feedback,
Is there any benefit moving to 3.01.01.00 (1.50.00.58) from 3.01.00.05 (1.40.00.45) in my case?
Also, I've read that I lose some flash, due to page alignment with the Split Image build. I'm on very tight bounds as it is, but do you know of any examples or resources that would point me in the direction of using the external flash to perhaps hold the complete app image or other compiled resources?
Last question, is SNV supported in off chip flash? If not, can I store the bond manager, keys, etc.. in off chip storage?
Thank you,
Brett
Hi Kel,
Thanks for the reply, I think that is the route I am going to take.
Regards,
Brett
Hello everyone,
I've moved my project changes from ProjectZero into a copy of the Simple_Peripheral_cc2640r2lo_oad_offchip projects and am able to compile without errors.
I have to manually run the frontier tool since it seems the stack project isn't automatically running it when I rebuild even though it is defined in post-build steps:
Generated output of the manual execution makes sense :
/*
** Stack Frontier Generator 1.1.0 (2018-03-15 14:22:29.301000)
**
** WARNING - Auto-generated file. Modifications could be lost!
*/
--define=ICALL_RAM0_START=0x200041e0
--define=ICALL_STACK0_START=0x17530
--define=ICALL_STACK0_ADDR=0x1dd41
That's beside the point, I think.
My issue is that when I program and debug I don't even make it to the main() fxn in main.c.
Here is the output from the ROV from BIOS when it scans for errors:
ti.sysbios.knl.Task Module N/A schedulerState Swi scheduler state unknown ti.sysbios.knl.Task Detailed ti.sysbios.knl.Task.IdleTask stackPeak Overrun! ti.sysbios.knl.Task Basic ti.sysbios.knl.Task.IdleTask mode Invalid mode: 4 ti.sysbios.knl.Task Detailed ti.sysbios.knl.Task.IdleTask mode Invalid mode: 4 ti.sysbios.BIOS Module N/A currentThreadType Error: unknown thread type for current thread. ti.sysbios.knl.Semaphore Basic (0x20001f64) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xffffffe2, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Semaphore Basic (0x2000180c) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xff000000, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Event Basic (0x400e0368) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0x79519998, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Semaphore Basic (0x2000152c) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0x447f0e9, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Task Detailed (0x20001d28) stackPeak Error: Problem fetching Task stack: JavaException: java.lang.IndexOutOfBoundsException: null ti.sysbios.knl.Task Detailed (0x400e0318) stackPeak Error: Problem fetching Task stack: JavaException: java.lang.Exception: Target memory read failed at address: 0xd2cacbc9, length: 935415552 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Task Detailed (0x20001cd8) stackPeak Error: Problem fetching Task stack: Error: fetchArray called with length 0. ti.sysbios.family.arm.m3.Hwi Module N/A hwiStackPeak Error fetching Hwi stack info! ti.sysbios.family.arm.m3.Hwi Module N/A hwiStackSize Error fetching Hwi stack info! ti.sysbios.family.arm.m3.Hwi Module N/A hwiStackBase Error fetching Hwi stack info! ti.sysbios.knl.Task Module N/A hwiStackPeak Error fetching Hwi stack info! ti.sysbios.knl.Task Module N/A hwiStackSize Error fetching Hwi stack info! ti.sysbios.knl.Task Module N/A hwiStackBase Error fetching Hwi stack info! ti.sysbios.knl.Task Basic (0x400e0318) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.knl.Task Basic (0x20001d28) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.knl.Task Detailed (0x400e0318) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.knl.Task Detailed (0x20001d28) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.family.arm.m3.Hwi Basic (0x200008b4) N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 547: java.lang.Exception: Target memory read failed at address: 0x8c1fab7e, length: 200 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.family.arm.cc26xx.Timer Device (0x200006d8) N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 547: java.lang.Exception: Target memory read failed at address: 0x40092000, length: 28 ti.sysbios.knl.Queue Basic ti.sysbios.knl.Queue@20002038 N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0xfe00ffff, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Queue Basic ti.sysbios.knl.Queue@400e036c N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x79519998, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Clock Module N/A N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x11001258, length: 32 This read is at a VALID address according to the application's section map, but the DebugServer memory read failed. ti.sysbios.family.arm.m3.Hwi Module N/A exception An exception has occurred!
And the associated Task Stacks:
0x400e0318 is suppose to be the SDI task
0x20001d28 app stack
0x20001cd8 gapRoleSTack stack
I have increased the size of the idleTask stack to 4096 but the issue persists with the same outcome. I don't think the size is the issue but just a symptom.
Also to note, ive shuffled my memory to use GPCache and the Sensor Cache:
/****************************************************************************** @file cc26xx_app_oad.cmd @brief CC2650F128 linker configuration file for TI-RTOS with Code Composer Studio. Imported Symbols Note: Linker defines are located in the CCS IDE project by placing them in Properties->Build->Linker->Advanced Options->Command File Preprocessing. CACHE_AS_RAM: Disable system cache to be used as GPRAM for additional volatile memory storage. CCxxxxROM: Device Name (e.g. CC2650). In order to define this symbol, the tool chain requires that it be set to a specific value, but in fact, the actual value does not matter as it is not used in the linker control file. The only way this symbol is used is based on whether it is defined or not, not its actual value. There are other linker symbols that do specifically set their value to 1 to indicate R1, and 2 to indicate R2, and these values are checked and do make a difference. However, it would appear confusing if the device name's value did not correspond to the value set in other linker symbols. In order to avoid this confusion, when the symbol is defined, it should be set to the value of the device's ROM that it corresponds so as to look and feel consistent. Please note that a device name symbol should always be defined to avoid side effects from default values that may not be correct for the device being used. ICALL_RAM0_START: RAM start of BLE stack. ICALL_STACK0_START: Flash start of BLE stack. PAGE_AlIGN: Align BLE stack boundary to a page boundary. Aligns to Flash word boundary by default. (Note: for OAD, page alignment must be used) OAD_IMG_(A,B,E) Used to designate OAD images: - A: On-chip OAD persistent application - B: On-chip OAD user application - E: Off-chip OAD application Group: CMCU, SCS Target Device: CC2640R2 ****************************************************************************** Copyright (c) 2013-2017, Texas Instruments Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************** Release Name: simplelink_cc2640r2_sdk_1_40_00_45 Release Date: 2017-07-20 17:16:59 *****************************************************************************/ /******************************************************************************* * CCS Linker configuration */ /* Retain interrupt vector table variable */ --retain=g_pfnVectors /* Override default entry point. */ --entry_point ResetISR /* Suppress warnings and errors: */ /* - 10063: Warning about entry point not being _c_int00 */ /* - 16011, 16012: 8-byte alignment errors. Observed when linking in object */ /* files compiled using Keil (ARM compiler) */ --diag_suppress=10063,16011,16012 /* The following command line options are set as part of the CCS project. */ /* If you are building using the command line, or for some reason want to */ /* define them here, you can uncomment and modify these lines as needed. */ /* If you are using CCS for building, it is probably better to make any such */ /* modifications in your CCS project and leave this file alone. */ /* */ /* --heap_size=0 */ /* --stack_size=256 */ /* --library=rtsv7M3_T_le_eabi.lib */ /******************************************************************************* * Memory Sizes */ #define FLASH_BASE 0x00000000 #define GPRAM_BASE 0x11000000 #define RAM_BASE 0x20000000 #define ROM_BASE 0x10000000 #ifdef CC26X0ROM #define FLASH_SIZE 0x00020000 #define GPRAM_SIZE 0x00002000 #define RAM_SIZE 0x00005000 #define ROM_SIZE 0x0001C000 #endif /* CC26X0ROM */ /******************************************************************************* * Memory Definitions ******************************************************************************/ /******************************************************************************* * RAM */ #ifdef CC26X0ROM #if CC26X0ROM == 2 #define RESERVED_RAM_SIZE 0x00000C00 #elif CC26X0ROM == 1 #define RESERVED_RAM_SIZE 0x00000718 #endif /* CC26X0ROM */ #endif /* CC26X0ROM */ #define RAM_START RAM_BASE #ifdef ICALL_RAM0_START #define RAM_END (ICALL_RAM0_START - 1) #else #define RAM_END (RAM_START + RAM_SIZE - RESERVED_RAM_SIZE - 1) #endif /* ICALL_RAM0_START */ #ifdef AUX_AS_RAM #define AUX_RAM_BASE 0x400E0000 #define AUX_RAM_SIZE 0x800 #endif /* AUX_AS_RAM */ /******************************************************************************* * Flash */ #define WORD_SIZE 4 #ifdef CC26X0ROM #define PAGE_SIZE 0x1000 #endif /* CC26X0ROM */ #ifdef PAGE_ALIGN #define FLASH_MEM_ALIGN PAGE_SIZE #else #define FLASH_MEM_ALIGN WORD_SIZE #endif /* PAGE_ALIGN */ #ifdef CC26X0ROM #define PAGE_MASK 0xFFFFF000 #endif /* CC26X0ROM */ /* The last Flash page is reserved for the BIM. */ #define NUM_RESERVED_FLASH_PAGES 1 #define RESERVED_FLASH_SIZE (NUM_RESERVED_FLASH_PAGES * PAGE_SIZE) #ifdef ICALL_STACK0_START #ifdef PAGE_ALIGN #define ADJ_ICALL_STACK0_START (ICALL_STACK0_START * PAGE_MASK) #else #define ADJ_ICALL_STACK0_START ICALL_STACK0_START #endif /* PAGE_ALIGN */ #endif #ifdef OAD_IMG_A #define FLASH_START 0 #define ENTRY_SIZE 0x40 #define ENTRY_END FLASH_START + FLASH_SIZE - RESERVED_FLASH_SIZE - 1 #define ENTRY_START ENTRY_END - ENTRY_SIZE + 1 #define FLASH_END ENTRY_START - 1 #else #define OAD_HDR_START 0 #define OAD_HDR_SIZE 0x50 #define OAD_HDR_END OAD_HDR_START + OAD_HDR_SIZE - 1 #define ENTRY_START OAD_HDR_END + 1 #define ENTRY_SIZE 0x40 #define ENTRY_END ENTRY_START + ENTRY_SIZE - 1 #define FLASH_START ENTRY_END + 1 #define FLASH_END ICALL_STACK0_START - 1 #endif /******************************************************************************* * Stack */ /* Create global constant that points to top of stack */ /* CCS: Change stack size under Project Properties */ __STACK_TOP = __stack + __STACK_SIZE; /******************************************************************************* * GPRAM */ #ifdef CACHE_AS_RAM #define GPRAM_START GPRAM_BASE #define GPRAM_END (GPRAM_START + GPRAM_SIZE - 1) #endif /* CACHE_AS_RAM */ /******************************************************************************* * Main arguments */ /* Allow main() to take args */ /* --args 0x8 */ /******************************************************************************* * ROV * These symbols are used by ROV2 to extend the valid memory regions on device. * Without these defines, ROV will encounter a Java exception when using an * autosized heap. This is a posted workaround for a known limitation of * RTSC/rta. See: bugs.eclipse.org/.../show_bug.cgi * * Note: these do not affect placement in RAM or FLASH, they are only used * by ROV2, see the BLE Stack User's Guide for more info on a workaround * for ROV Classic * */ __UNUSED_SRAM_start__ = 0x20000000; __UNUSED_SRAM_end__ = 0x20005000; __UNUSED_FLASH_start__ = 0; __UNUSED_FLASH_end__ = 0x1FFFF; /******************************************************************************* * System Memory Map ******************************************************************************/ MEMORY { /* EDITOR'S NOTE: * the FLASH and SRAM lengths can be changed by defining * ICALL_STACK0_START or ICALL_RAM0_START in * Properties->ARM Linker->Advanced Options->Command File Preprocessing. */ FLASH (RX) : origin = FLASH_START, length = ((FLASH_END - FLASH_START) + 1) ENTRY (RX) : origin = ENTRY_START, length = ENTRY_SIZE #ifndef OAD_IMG_A FLASH_IMG_HDR (RX) : origin = OAD_HDR_START, length = OAD_HDR_SIZE #endif #ifdef ICALL_RAM0_START SRAM (RWX) : origin = RAM_START, length = ICALL_RAM0_START - RAM_START #else SRAM (RWX) : origin = RAM_START, length = RAM_END - RAM_START + 1 #endif #ifdef CACHE_AS_RAM GPRAM (RWX) : origin = GPRAM_START, length = GPRAM_SIZE #endif /* CACHE_AS_RAM */ #ifdef AUX_AS_RAM AUX_RAM (RWX) : origin = AUX_RAM_BASE, length = AUX_RAM_SIZE #endif /* AUX_AS_RAM */ } /******************************************************************************* * Section Allocation in Memory ******************************************************************************/ SECTIONS { #ifdef OAD_IMG_A GROUP > FLASH(HIGH) { .image_header align PAGE_SIZE .text .const .constdata .rodata .emb_text .init_array .cinit .pinit }LOAD_END(flashEndAddr) GROUP > ENTRY { .resetVecs .intvecs EntrySection LOAD_START(prgEntryAddr) } #else // OAD_IMG_B || OAD_IMG_E GROUP > FLASH_IMG_HDR { .image_header align PAGE_SIZE } GROUP > ENTRY { .resetVecs .intvecs EntrySection LOAD_START(prgEntryAddr) } GROUP >> FLASH { .text .const .constdata .rodata .emb_text .pinit } .cinit : > FLASH LOAD_END(flashEndAddr) #endif // OAD_IMG_A GROUP > SRAM { .data LOAD_START(ramStartHere) .bss .vtable .vtable_ram vtable_ram .sysmem .nonretenvar } LOAD_END(heapStart) .stack : > SRAM (HIGH) LOAD_START(heapEnd) #ifdef CACHE_AS_RAM reorganized_into_gpcache { icall.obj(.data) icall.obj(.bss) // device_information.obj(.data) notification.obj(.data) // request.obj(.data) // spectrum_data.obj(.data) SRI_Global.obj(.data) CommandHandler.obj(.data) RFCC26XX_singleMode.obj(.bss) } > GPRAM #endif /* CACHE_AS_RAM */ #ifdef AUX_AS_RAM reorganized_into_auxram { sdi_task.obj(.data) sdi_task.obj(.bss) sdi_rxbuf.obj(.bss) sdi_tl_uart.obj(.bss) sdi_tl.obj(.bss) sdi_tl.obj(.data) } > AUX_RAM #endif/* AUX_AS_RAM */ }
I'm not sure where to go from here, can someone point me in the right direction?
Attached are my project(s) and stack/appOffChipOad.zip .mem files
Thank you all again for your time and support,
Regards,
Brett
Hello Again,
Another clue is that while debugging I step through rom_init.c and it seems as though the hang-up occurs somewhere in RT_Init_ROM() :
/* ** Controller ROM */ // execute the ROM C runtime initialization // Note: This is the ROM's C Runtime initialization, not the flash's, which // has already taken place. RT_Init_ROM(); // initialize ICall function pointers for ROM // Note: The address of these functions is determined by the Application, and // is passed to the Stack image via startup_entry. *pICallRomDispatch = (uint32)ICall_dispatcher; *pICallRomEnterCS = (uint32)ICall_enterCriticalSection; *pICallRomLeaveCS = (uint32)ICall_leaveCriticalSection; // initialize RAM pointer to ROM Flash JT for ROM code *pROM_JT = (uint32)ROM_Flash_JT; return;
Hi Kel,
Thanks for the reply.
Yes, i am using the 1_40_00_45 SDK.
I tried using the Flash Programmer to write all images (BIM, STACK, APP) but with the same out come.
One difference i just noticed was the with the ProjectZero app, the ICall Heap was allocated in the remaining SRAM space.
And with the Simple Peripheral Off-Chip OAD Example, it appears i now have explicit secotrs defined:
.bss:heapmgrHeapStore
.common:ti_sysbios_heaps_HeapMem_Instance_State_0_buf_A
This could be causing issues since my App did require a large Heap. But then again, I never make it into the App main() fxn.
I thought the heap would have been the same with both projects.
I did however set OSAL_SNV = 0, not sure if that would affect the heap though.
Thank you again!
Brett
Hi Kel,
Thank you for the reply.
To clarify, the non-ble5 simple peripheral off chip oad example worked fine on the LaunchXL platform. My issues arose once I migrated my ProjectZero project on custom hardware into the simple peripheral off chip oad project.
I think perhaps now the issue is that I have these two large objects in SRAM, and I have never seen them before with the original simple peripheral project nor the project zero project: the first two objects under .bss.
My application still hangs at RT_Init_ROM(); in rom_init.c that is called from icall_startup.c
Perhaps there is some relation between those memory object instances and the application hanging at RT_Init_ROM(); ?
You mentioned there are some issues with the 1.40 version. Should I migrate to version 1.50?
Thank for your continued help Kel,
Regards,
Brett
My memory discrepancies are back to normal, i had caused them by removing utils.importFile("common/cc26xx/kernel/cc2640/config/ble_stack_heap.cfg"); from app_ble.config.
I have also moved the icall.obj to GPCache so that my heap has plenty of room.
Im back to the original issue i cant seem to get past: From the ROV Bios Erros:
ti.sysbios.knl.Task Module N/A schedulerState Swi scheduler state unknown ti.sysbios.knl.Task Detailed ti.sysbios.knl.Task.IdleTask stackPeak Overrun! ti.sysbios.knl.Task Basic ti.sysbios.knl.Task.IdleTask mode Invalid mode: 4 ti.sysbios.knl.Task Basic (0x20001d10) mode Invalid mode: 4 ti.sysbios.knl.Task Detailed ti.sysbios.knl.Task.IdleTask mode Invalid mode: 4 ti.sysbios.knl.Task Detailed (0x20001d10) mode Invalid mode: 4 ti.sysbios.BIOS Module N/A currentThreadType Error: unknown thread type for current thread. ti.sysbios.knl.Semaphore Basic (0x200017f4) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xffffffff, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Event Basic (0x400e0368) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0x79519998, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Semaphore Basic (0x20001514) pendElems Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0x1210068, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Task Detailed (0x20001d10) stackPeak Error: Problem fetching Task stack: JavaException: java.lang.IndexOutOfBoundsException: null ti.sysbios.knl.Task Detailed (0x400e0318) stackPeak Error: Problem fetching Task stack: JavaException: java.lang.Exception: Target memory read failed at address: 0xd24fdbc9, length: 935677696 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Task Detailed (0x20001cc0) stackPeak Error: Problem fetching Task stack: Error: fetchArray called with length 0. ti.sysbios.family.arm.m3.Hwi Module N/A hwiStackPeak Error fetching Hwi stack info! ti.sysbios.family.arm.m3.Hwi Module N/A hwiStackSize Error fetching Hwi stack info! ti.sysbios.family.arm.m3.Hwi Module N/A hwiStackBase Error fetching Hwi stack info! ti.sysbios.knl.Task Module N/A hwiStackPeak Error fetching Hwi stack info! ti.sysbios.knl.Task Module N/A hwiStackSize Error fetching Hwi stack info! ti.sysbios.knl.Task Module N/A hwiStackBase Error fetching Hwi stack info! ti.sysbios.knl.Task Basic (0x400e0318) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.knl.Task Basic (0x20001cc0) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.knl.Task Detailed (0x400e0318) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.knl.Task Detailed (0x20001cc0) priority Corrupted data: Task priority is greater than Task.numPriorities ti.sysbios.family.arm.m3.Hwi Basic (0x2000089c) N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 547: java.lang.Exception: Target memory read failed at address: 0xe0b4f8df, length: 200 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.family.arm.cc26xx.Timer Device (0x200006d8) N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 547: java.lang.Exception: Target memory read failed at address: 0x40092000, length: 28 ti.sysbios.knl.Queue Basic ti.sysbios.knl.Queue@2000202c N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0xf5a002b5, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Queue Basic ti.sysbios.knl.Queue@400e036c N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x79519998, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Queue Basic ti.sysbios.knl.Queue@20002020 N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x2044414f, length: 8 This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt. ti.sysbios.knl.Clock Module N/A N/A Caught exception in view init code: "C:/ti/xdctools_3_50_02_20_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x11001248, length: 32 This read is at a VALID address according to the application's section map, but the DebugServer memory read failed. ti.sysbios.family.arm.m3.Hwi Module N/A exception An exception has occurred!
Hi Brett,
I have ported the Project Zero BLE Profiles to SDK v1.40 Simple Peripheral Off-Chip OAD Example Program before. I did not need to modify any linker files. To port the Project Zero BLE Profiles, you need to know what are the differences of SDK v1.30 and SDK v1.40. The differences should be mentioned at the porting guide.
Here below are some differences.
Project Zero SDK v1.30 led_service.c
/********************************************************************* * INCLUDES */ #include <string.h> //#define xdc_runtime_Log_DISABLE_ALL 1 // Add to disable logs from this file #include <xdc/runtime/Log.h> #include <xdc/runtime/Diags.h> #include "bcomdef.h" #include "OSAL.h" #include "linkdb.h" #include "att.h" #include "gatt.h" #include "gatt_uuid.h" #include "gattservapp.h" #include "gapbondmgr.h" #include <icall_api.h> #include "led_service.h"
Simple Peripheral SDK v1.40 simple_gatt_profile.c
/********************************************************************* * INCLUDES */ #include <string.h> #include <icall.h> #include "util.h" /* This Header file contains all BLE API and icall structure definition */ #include "icall_ble_api.h" #include "simple_gatt_profile.h"
The SDK v1.30 uses icall_api.h. The SDK v1.40 uses icall_ble_api.h. You can see more information about icall_ble_api.h at the SDK v1.40 documentation.
-kel