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.

using of F035 flash library and freertos together

Other Parts Discussed in Thread: HALCOGEN

is it possible, to use f035 flash library together with freertos ?

for now i am trying to switch to the privileged mode and call Flash_Compact_B.

and somewhere inside "setup_state_machine" function,  dataEntry interrupt occurs.

    BOOL ret = 0;
    FLASH_STATUS_ST status;
    portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();
    ret = Flash_Compact_B((UINT32*)0x00180000, FLASH_CORE3,FLASH_SECT0,80,(FLASH_ARRAY_ST)0xfff87000,&status);
    portRESET_PRIVILEGE( xRunningPrivileged );

P.S. my cpu in tms570ls20216szwt, halcogen 03.08.01, f035 library v1.09

  • Dmitry,

     

    Which device are you using?

    One point to remember is, you cannot execute and compact/erase/program from the same bank.
    You are running FreeRtos, so the Bank0 Sector0 will be accessed by FreeRtos (Exception table)
    Based on this statement, you will not be able to use the FLASH API to work on bank0.

    Usually, the FLASH API is loaded in RAM and run in RAM to bypass this limitation.

     

     

  • Thanks for the quick reply !

    I am using tms570ls20216szwt in my own device. as you can see in my example i am using the last bank (FLASH_CORE3),  and additionally, this bank is excluded from "SECTIONS" of linker script. сan I work in this configuration without loading into memory?

     

  • Hi Dmitry,

    Is this code being executed from RAM or Flash Bank 0?

    The setup_state_machine function must be executed from RAM only. 

    Best Regards,

    Siddharth

  • Hello,

    code executes from Flash. where I can get an example of how to execute it from RAM ?

    Thanks.

  • Hello Dmitry,

    You can refer to the following post http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/62954/227583.aspx#227583

    This provides an example linker command file that would put the Flash API in Flash but run it from RAM.

    It also provides an example code to copy the Flash API to RAM.

    Best Regards,

    Siddharth

  • it seems that this does not work.

    here is my linker script.

    /*----------------------------------------------------------------------------*/
    /* sys_link_freeRTOS.cmd                                                      */
    /*                                                                            */
    /* (c) Texas Instruments 2009-2013, All rights reserved.                      */
    /*                                                                            */
    /*----------------------------------------------------------------------------*/
    /* USER CODE BEGIN (0) */
    /* USER CODE END */
    /*----------------------------------------------------------------------------*/
    /* Linker Settings                                                            */
    
    --retain="*(.intvecs)"
    
    /* USER CODE BEGIN (1) */
    /* USER CODE END */
    
    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */
    
    MEMORY
    {
        VECTORS (X)  : origin=0x00000000 length=0x00000020
        KERNEL  (RX) : origin=0x00000020 length=0x00008000 
        FLASH0  (RX) : origin=0x00008020 length=0x00077FE0
        FLASH1  (RX) : origin=0x00080000 length=0x00080000
        FLASH2  (RX) : origin=0x00100000 length=0x00080000
        FLASH3  (RX) : origin=0x00180000 length=0x00080000
        STACKS  (RW) : origin=0x08000000 length=0x00001500
        KRAM    (RW) : origin=0x08001500 length=0x00000800
    	RAM     (RW) : origin=(0x08001500+0x00000800) length=(0x00026b00 - 0x00000800)
    	
    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }
    
    /* USER CODE BEGIN (3) */
    #if 0
    /* USER CODE END */
    
    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */
    
    SECTIONS
    {
        .intvecs : {} > VECTORS
        /* FreeRTOS Kernel in protected region of Flash */
        .kernelTEXT   : { sys_startup.obj(.const)
        				  os_tasks.obj (.const:.string)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<auto_init.obj> (.text)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<copy_decompress_rle.obj> (*)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<cpy_tbl.obj> (*)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<copy_zero_init.obj> (*)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<copy_decompress_none.obj> (*)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<icall32.obj> (.text)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<memset32.obj> (.text)
        				  -l=rtsv7R4_T_be_v3D16_eabi.lib<memcpy32.obj> (.text)
        				} > KERNEL
        .cinit        : {} > KERNEL
        .pinit        : {} > KERNEL
    	/* Rest of code to user mode flash region */
        .text         : {} > FLASH0 | FLASH1 | FLASH2 | FLASH3
        .const        : {} > FLASH0 | FLASH1 | FLASH2 | FLASH3
    	/* FreeRTOS Kernel data in protected region of RAM */
        .kernelBSS    : {} > KRAM
        .kernelHEAP   : {} > RAM
        .bss          : {} > RAM
        .data         : {} > RAM	
    	
    /* USER CODE BEGIN (4) */
    #endif
    SECTIONS
    {
        .intvecs : {} > VECTORS
        /* FreeRTOS Kernel in protected region of Flash */
        .kernelTEXT   : { sys_startup.obj(.const)
                          os_tasks.obj (.const:.string)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<auto_init.obj> (.text)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<copy_decompress_rle.obj> (*)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<cpy_tbl.obj> (*)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<copy_zero_init.obj> (*)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<copy_decompress_none.obj> (*)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<icall32.obj> (.text)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<memset32.obj> (.text)
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<memcpy32.obj> (.text)
                        } > KERNEL
        .cinit        : {} > KERNEL
        .pinit        : {} > KERNEL
        /* Rest of code to user mode flash region */
        .text         : {} > FLASH0 | FLASH1 | FLASH2
        .const        : {} > FLASH0 | FLASH1 | FLASH2
    
        .flashapi : load = FLASH1, run = RAM, LOAD_START(FlashApi_LoadStart), LOAD_END(FlashApi_LoadEnd), LOAD_SIZE(FlashApi_LoadSize), RUN_START(FlashApi_RunStart), RUN_END(FlashApi_RunEnd), RUN_SIZE(FlashApi_RunSize),
        {
            pf035a_api_eabi.lib (.text)
        }
        /* FreeRTOS Kernel data in protected region of RAM */
        .kernelBSS    : {} > KRAM
        .kernelHEAP   : {} > RAM
        .bss          : {} > RAM
        .data         : {} > RAM    
    
    /* USER CODE END */
    }
    
    /* USER CODE BEGIN (5) */
    /* USER CODE END */
    
    /*----------------------------------------------------------------------------*/
    /* Misc                                                                       */
    
    /* USER CODE BEGIN (6) */
    /* USER CODE END */
    /*----------------------------------------------------------------------------*/
    

    it gives a warning

    "../halcogen/source/sys_link.cmd", line 82: warning #10068-D: no matching section
    <Linking>
    Finished building target: new_mu.out
     
    Create flash image: Intel-HEX
    "/opt/ti/ccsv5/tools/compiler/arm_5.1.1/bin/armhex" -i "new_mu.out" -o "new_mu.hex" -order MS -romwidth 32
    Translating to Intel format...
       "new_mu.out"   ==> .intvecs
       "new_mu.out"   ==> .kernelTEXT
       "new_mu.out"   ==> .cinit
       "new_mu.out"   ==> .text
       "new_mu.out"   ==> .const
     
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<icall32.obj> (.text)
    "../halcogen/source/sys_link.cmd", line 83: warning #10068-D: no matching section
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<memset32.obj> (.text)
    "../halcogen/source/sys_link.cmd", line 84: warning #10068-D: no matching section
                          -l=rtsv7R4_T_be_v3D16_eabi.lib<memcpy32.obj> (.text)
    "../halcogen/source/sys_link.cmd", line 94: warning #10068-D: no matching section
            pf035a_api_eabi.lib (.text)
    
    **** Build Finished ****

    it seems that the section didn't even get created.

    if i print FlashApi_LoadStart,FlashApi_LoadEnd,FlashApi_LoadSize

    printf("start: %p\n", (char *)&FlashApi_LoadStart);
    printf("run: %p\n", (char *)&FlashApi_RunStart);
    printf("size: %i\n", (unsigned int)&FlashApi_LoadSize);

    i get

    start: 8001d00
    run: 8001d00
    size: 0

    so the load function does not work either...

    Code Composer Studio Version: 5.5.0.00077

    halcogen 03.08.01