Other Parts Discussed in Thread: TMS320F28386S, C2000WARE
I was using plain ole printf() to print to the console. Now it longer works and locks the program in progress. It seems to stop on __TI_file_lock(stdout);
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.
I was using plain ole printf() to print to the console. Now it longer works and locks the program in progress. It seems to stop on __TI_file_lock(stdout);
CCS version: 11.1.0.00011
Compiler: V22.6.0.LTS
The device is TMS320F28386S.
Host OS: Windows 10 Pro, version 10.0.19044 Build 19044.
Test case:
The project is an import of C:\ti\c2000\C2000Ware_4_02_00_00\driverlib\f2838x\examples\c28x_dual\flash_kernel\
The file is flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu1.c
I added lines 50, 70, and 71. When started it locks up. Also single stepping does not return from line 70.
//########################################################################### // // FILE: flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu1.c // // TITLE: CM kernel main function // //########################################################################### // $Copyright: // Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com // // 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. // $ //########################################################################### // // Included Files // #include <flash_kernel_c28x_dual_ex1_erase_cpu1.h> #include <string.h> #include "flash_programming_f2838x_c28x.h" // Flash API example header file #include "F021_F2838x_C28x.h" #include "cpu1bootrom.h" #include "device.h" #include "stdio.h" // // Function Prototypes // void exampleError(Fapi_StatusType status); void initFlashSectors(void); void SeizeFlashPump_kernels(void); extern uint32_t sciGetFunction(uint32_t BootMode); extern void sciaFlush(void); // // Main // uint32_t main(void) { // // flush SCIA TX port by waiting while it is busy, driverlib. // sciaFlush(); printf("\r\nConsole test."); fflush(stdout); // // initialize device and GPIO, driverlib. // Device_init(); Device_initGPIO(); // // init interrupt and vectorTable, drivelib. // Interrupt_initModule(); Interrupt_initVectorTable(); // // Enable Global Interrupt (INTM) and realtime interrupt (DBGM) // EINT; ERTM; // // At 200MHz, execution wait-states for external oscillator is 3. Modify the // wait-states when the system clock frequency is changed. // Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, 3); Flash_claimPumpSemaphore(FLASH_CPU1_WRAPPER); // // initialize flash_sectors, fapi + driverlib // initFlashSectors(); uint32_t EntryAddr; // // parameter SCI_BOOT for GPIO28 (RX),29 (TX) is default. // EntryAddr = sciGetFunction(SCI_BOOT); return(EntryAddr); } // // Init_Flash_Sectors - Initialize flash API and active flash bank sectors // void initFlashSectors(void) { EALLOW; Fapi_StatusType oReturnCheck; oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200); if(oReturnCheck != Fapi_Status_Success) { exampleError(oReturnCheck); } oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0); if(oReturnCheck != Fapi_Status_Success) { exampleError(oReturnCheck); } EDIS; } // // exampleError - For this example, if an error is found just stop here // #ifdef __TI_COMPILER_VERSION__ #if __TI_COMPILER_VERSION__ >= 15009000 #pragma CODE_SECTION(exampleError,".TI.ramfunc"); #else #pragma CODE_SECTION(exampleError,"ramfuncs"); #endif #endif void exampleError(Fapi_StatusType status) { // // Error code will be in the status parameter // __asm(" ESTOP0"); } // // End of file //
Thanks.
You earlier mentioned:
Now it longer works and locks the program in progress
Looks like printf was once working as expected. Was this with the same project, device, and CCS version? Or was it a different environment altogether?
Thanks
ki
It is likely an issue specific to the project. I searched around in the forums and found the below thread:
btw - I can reproduce the issue with the same examples (+ your modifications). I don't have an explanation (yet) on the root cause however.
Meanwhile I had a workaround. It wasn't much work to create a write routine to spit out messages to SCI B and a Putty window.
Thanks for sharing. We often don't see much printf (over JTAG) usage on MCUs like C2000 due to the high resource demands. Alternate methods such as you describe are more common.