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.

Documentation does not specify small model .switch section must be in same page as .bss. XAR3 upper bits contaminated during interrupt.



We find that the TMS320C55xx compiler is generating code that  can fail with larger switch tables in use.   XAR3 holds an address from the .switch section for a few instructions violating the rule for preservation of the upper 16bit of XAR registers (same as that of .bss) in the presense of interrupts.   We suggest that either the documentation change to indicate that the .switch section should be located along with other data sections in the same page as .bss or the compiler should be changed to avoid this.

 

Here are the relevant sections from the documentation:

 

SPRU281F - TMS320C55x Optimizing C/C++ Compiler v 4.4

6.1.1 Small Memory Model

The use of the small memory model results in code and data sizes that are slightly smaller and more

efficient than when using the larger memory models. However, your program must meet certain size and

memory placement restrictions.

In the small memory model, the following sections must all fit within a single page of memory that is 64K

words in size.

• The .bss and .data sections (all static and global data)

• The .stack and .sysstack sections (the primary and secondary system stacks)

• The .sysmem section (dynamic memory space)

• The .const section

No section may cross a hardware page boundary. There is no other restriction on the size or placement of

.text sections (code), .switch sections (switch statements), or .cinit/.pinit sections (variable initialization).

In the small model, the compiler uses 16-bit data pointers to access data. The upper 7 bits of the XARn

registers are set to point to the page that contains the .bss section. They remain set to that value

throughout program execution.

 

SPRU376A TMS320C55x DSP Programmer’s Guide

 

3.5.4 Allocating Code and Data in the C55x Memory Map

 

“When compiling with the small memory model (compiler default) allocate all

data sections, .data, .bss, .stack, .sysmem, .sysstack, .cio, and .const, on the

first 64K word page of memory (Page 0).”

 

Our situation was as follows:

 

If the .switch section is placed outside of the page containing .bss it can cause corruption when a small model interrupt occurs.  The data here has been setup for page 0 (first 64K words).  But the .switch section was allowed to be in higher memory.   This was following the above information (although the switch information is classified as data by the linker map).  Note that the upper 16bits of the address are 1 here:

.switch      0   [ 0003d138 ]  0001e89c          *   00000456  

                 [ 0003d138 ]  0001e89c          *   00000104   c_tim_gateway_aux.obj (.switch:_HandleAuxIndCtlMail__14CTimGatewayAuxFUiN21)

                 [ 0003d340 ]  0001e9a0          *   000000d8   aux_interface.obj (.switch:_auxHandleSetIndCtlMessages)

                 [ 0003d4f0 ]  0001ea78          *   00000054   c_dect_link_controller.obj (.switch:_Process__19CDectLinkControllerFP8CMessageUl)

 

If this code from a small model switch statement the target jump address is loaded using the switch table for the method (c_dect_link_controller).  ACO gets the address of the jump location from the .switch data, but XAR3 upper 16 bits are contaminated to 0x1 by this.  An interrupt happening just at the point of loading XAR3 results in a system crash in our builds.    Either small model builds should generate switch table code that does not contaminate XAR3 or the documentation should indicate that .switch sections should be located in the same page as the other data along with .bss.

 

04092f:               $C$DW$L$_Process__19CDectLinkControllerFP8CMessageUl$62$B:

04092f: 7c00019b         SUB #1,AR3,AR1

040933: 7a00010a         MOV #1 << #16,AC0

040937: 7eeab800_5190    OR #60088,AC0,AC0 || SFTL AR1,#1

04093d: 7dffff19         AND #65535,AR1,AC1

040941: 2410             ADD AC1,AC0

040943: 900b             MOV AC0,XAR3

040945: ed6108           MOV dbl(*AR3),AC0

040948: ec31be004f7c     AMAR *(#04f7ch),XAR3

04094e: 9100             B AC0

 

Below you can see the location where XAR3 has violated the rule.

 

 

 

 

 

  • I forgot the compiler options below:

    The compiler is 4.4.1

    TI DSP BIOS 5.41.13.42

    The interrupts involved are those in the DMA CSL libraries provided to us as part of the audio framework with optimization:

    -vcpu:3.3 --memory_model=large -O3 -g --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/dma/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/inc/" --include_path="C:/ti/ccsv5/ccsv5/tools/compiler/c5500_4.4.1/include" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/dma/build/dma_bios_drv_lib/Release" --include_path="C:/ti/ccsv5/bios_5_41_13_42/packages/ti/bios/include" --include_path="C:/ti/ccsv5/bios_5_41_13_42/packages/ti/rtdx/include/c5500" --include_path="C:/ti/ccsv5/xdais_7_21_01_07/packages/ti/xdais" --define="NDEBUG" --super_quiet --diag_warning=225 --gen_func_subsections=on --opt_for_space=3 --super_quiet

    The switch tables came from code compiled with these options:

    -v5535 --memory_model=small -g --include_path="C:/P4/lonestar/technologies/blade_runner/c_cpp/inc/" --include_path="C:/P4/lonestar/technologies/bcsp/inc/" --include_path="C:/P4/lonestar/platforms/dialog/sc14480/pingo_fp/Projects/Pingo/Components/BaseAuxTask" --include_path="C:/P4/lonestar/technologies/controllers/dev/code/user_interface_controller/inc" --include_path="C:/P4/lonestar/technologies/controllers/dev/code/button_controller/inc" --include_path="C:/P4/lonestar/technologies/controllers/dev/code/call_arbitration_controller/inc" --include_path="C:/P4/lonestar/technologies/controllers/dev/code/usb_call_controller/inc" --include_path="C:/P4/lonestar/platforms/dialog/sc14480/pingo_fp/Projects/Pingo/Include/ExtCtlTask" --include_path="C:/P4/lonestar/platforms/dialog/sc14480/pingo_fp/Projects/Pingo/Include/BaseAuxTask" --include_path="C:/P4/lonestar/apps/ti/dev/code/fw/inc/" --include_path="C:/P4/lonestar/apps/ti/dev/code/dsp/inc/" --include_path="C:/P4/lonestar/technologies/controllers/dev/code/dect_link_controller/inc" --include_path="C:/P4/lonestar/technologies/controllers/dev/code/common/inc" --include_path="C:/P4/lonestar/platforms/ti/c55xx/dsp/dev/code/plt_dsp_modules/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/dsp/dev/code/plt_dsp_utilities/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/dsp/dev/code/plt_dsp_audiomanager/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/pal_os/inc/" --include_path="C:/P4/lonestar/technologies/usb/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/i2c/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/asrc/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/dma/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55xx_csl/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/rtos_abstraction_lib/dev/code/fw/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/plt_stream_lib/inc/" --include_path="C:/ti/ccsv5/ccsv5/tools/compiler/c5500_4.4.1/include" --include_path="C:/P4/lonestar/apps/ti/dev/Debug_neptune_small" --include_path="C:/ti/ccsv5/bios_5_41_13_42/packages/ti/bios/include" --include_path="C:/ti/ccsv5/bios_5_41_13_42/packages/ti/rtdx/include/c5500" --include_path="C:/ti/ccsv5/xdais_7_21_01_07/packages/ti/xdais" --define="_DEBUG" --define=NOT_DISPLAY_LOCAL=1 --define="PATTERHORN_MIC_GAIN_dB=12" --define=NOT_BUTTON_CONTROLLER_DUMP_ENABLE --define=NOT_CALL_ARBITRATION_CONTROLLER_DUMP_ENABLE --define=NOT_DECT_LINK_CONTROLLER_DUMP_ENABLE --define=NOT_TIM_CALL_CONTROLLER_DUMP_ENABLE --define=NOT_USB_CALL_CONTROLLER_DUMP_ENABLE --define=NOT_USER_INTERFACE_CONTROLLER_DUMP_ENABLE --define="NASSERT" --define="_nassert=plt_assert_override" --define="nullptr=(0L)" --define="PLT_DSP=0" --define="PLT_PATTERHORN=0" --define="PLT_NEPTUNE=1" --define="SAMPLE_RATE=16000" --define="PLT_USB=1" --define="BIOS_BUILD" --define="CSL_AC_TEST" --define=c5535 --super_quiet --display_error_number --diag_suppress=77 --diag_warning=225 --gen_func_subsections=on --ptrdiff_size=16 --algebraic --printf_support=nofloat --super_quiet

  • Even in small model, the interrupt function is responsible for saving and restoring the upper 7 bit in each XAR register if it might be accessed during the interrupt handler or any function it calls. It is true that the documentation is slightly misleading; it should actually say something like:

    The upper 7 bits of the XARn registers are set to point to the page that contains the .bss section. They remain set to that value throughout program execution, except when accessing a switch table. When accessing a switch table, the compiler will modify the upper bits of an XAR register temporarily, then restore its value before any function is called. As interrupt functions are required to save and restore the upper bits of XAR registers if used, this behavior is interrupt-safe.

    I've submitted SDSCM00046328 to address this documentation issue.  At this time, the compiler's behavior is not likely to change.

    You show the "DMA CSL library" interrupts as being compiled with --memory_model=large, which is not compatible with --memory_model=small; how is it that you are able to link these together?

  • Hello,

        I listed the CSL build options incorrectly we are linking to the small model build.  I believe the linker would complain as you implied had we tried that.  Sorry for the incorrect information (the correct listing is below).  The issue is not that the ISR should save and restore the XARn registers.  The issue is that the ISR calls small model code that assumes that XARn registers are behaving as the model expects.   It ends  up crashing because the switch table code has contaminated the upper 16 bits during the 3 or so instructions where the switch table target address is loaded into XAR3 prior to moving into AC0 restoring XAR3 and calling AC0.   

    --vcpu:3.3 --memory_model=small -g --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/dma/inc/" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/inc/" --include_path="C:/ti/ccsv5/ccsv5/tools/compiler/c5500_4.4.1/include" --include_path="C:/P4/lonestar/platforms/ti/c55xx/framework/c55x5_drivers/dma/build/dma_bios_drv_lib/Debug_small" --include_path="C:/ti/ccsv5/bios_5_41_13_42/packages/ti/bios/include" --include_path="C:/ti/ccsv5/bios_5_41_13_42/packages/ti/rtdx/include/c5500" --include_path="C:/ti/ccsv5/xdais_7_21_01_07/packages/ti/xdais" --define="_DEBUG" --define="NASSERT" --define="_nassert=plt_assert_override" --super_quiet --diag_warning=225 --gen_func_subsections=on --ptrdiff_size=16 --super_quiet

  • The interrupt function is responsible for not only saving and restoring registers, but also placing the state (which includes the registers) in an acceptable condition for calling C functions, if it does call C functions.  That is, the interrupt function is responsible for assigning the upper 7 bits of the address of .bss to each of the upper 7 bits of the XAR registers.  If you compile a C-written interrupt handling function and look at the generated assembly code, you'll see that the compiler does just that:

    void interrupt func(void)
    {
        call();
    }
    [..]
            .ref ___bss__
            AMOV #___bss__, XAR0
            AMAR *AR0, XAR1
            AMAR *AR0, XAR2
            AMAR *AR0, XAR3
            AMAR *AR0, XAR4
            AMAR *AR0, XAR5
            AMAR *AR0, XAR6
            AMAR *AR0, XAR7
            AMAR *AR0, XCDP
    
  • Thanks for the clarification.   Keep in mind we have apparently a work around to place the .switch section in the same page as we have data (page0).   I do see an "interrupt" labeled 'C' function generating the code you indicate when I follow your example using small model.  So it looks to be an issue with DSP/BIOS combined with small model and use of larger switch statements that load from .switch.  We are using   DSP/BIOS 5.41.13.42 

    I see the linker command file generated by the .tcf configuration file referencing the small version of  DSP/BIOS 5.41.13.42  We are using

    -lbios.a55             /* DSP/BIOS support */

    It is bios.a55L if it is large model.  The HWI_F_dispatch code shown in disassembler does not show the setting of the upper 7 bits of the XARn registers to the value for .bss.    The DSP/BIOS documentation indicates that "interrupt" or pragma INTERRUPT should not be used for interrupt handlers called from DSP/BIOS HWI dispatch:

    spru423h_TMS320C55X_dsp_bios_user_guide:

    " 4.2.4 Context and Interrupt Management Within Interrupts
    When a hardware interrupt preempts the function that is currently executing,
    the HWI function must save and restore any registers it uses or modifies.
    DSP/BIOS provides the HWI_enter assembly macro to save registers and the
    HWI_exit assembly macro to restore registers. Using these macros gives the
    function that was preempted the same context when it resumes running. In
    addition to the register context saving/restoring functionality, the
    HWI_enter/HWI_exit macros perform the following system level operations:
    ❏ ensure the SWI and TSK schedulers are called at the appropriate times
    ❏ disable/restore individual interrupts while the ISR executes
    The HWI_enter assembly macro must be called prior to any DSP/BIOS API
    calls that could post or affect a software interrupt or semaphore. The
    HWI_exit assembly macro must be called at the very end of the function’s
    code.
    In order to support interrupt routines written completely in C, DSP/BIOS
    provides an HWI dispatcher that performs these enter and exit macros for an
    interrupt routine. An HWI can handle context saving and interrupt disabling
    using this HWI dispatcher or by explicitly calling HWI_enter and HWI_exit.
    The HWI configuration properties allow you to choose whether the HWI
    dispatcher is used for individual HWI objects. The HWI dispatcher is the
    preferred method for handling interrupts.
    The HWI dispatcher, in effect, calls the configured HWI function from within
    an HWI_enter/HWI_exit macro pair. This allows the HWI function to be written
    completely in C. It would, in fact, cause a system crash were the dispatcher
    to call a function that contains the HWI_enter/HWI_exit macro pair. Using the
    dispatcher therefore allows for only one instance of the HWI_enter and
    HWI_exit code.
    Note:
    The interrupt keyword or INTERRUPT pragma must not be used when
    HWI objects are used in conjunction with C functions.The
    HWI_enter/HWI_exit macros and the HWI dispatcher contain this
    functionality, and the use of the C modifier can cause program failure."

    The disassembly  in debug shows code that does not set the upper bits of XAR3 in testing and calls our handler C code. This matches the disassembly from:

    C:\ti\ccsv5\bios_5_41_13_42\packages\ti\bios\lib\temp>dis55 hwi_disp_asm.o55 > list.txt

    This is the debugger listing:


             HWI_F_dispatch, HWI_F_dispatch:
    02c9cc:   b508_98                  PSH mmap(@ST3_55)
    02c9cf:   f4067900_98              AND #30976,mmap(@ST1_55)
    02c9d4:   46f5                     BSET ST2_ARMS
    02c9d6:   46e3                     BSET ST1_CPL
    02c9d8:   4617                     BSET ST3_SMUL
    02c9da:   4683                     BSET ST1_SXMD
    02c9dc:   4656                     BCLR ST3_SATA
    02c9de:   4606                     BCLR ST3_SST
    02c9e0:   f496fa00_98              AND #64000,mmap(@ST2_55)
    02c9e5:   5085                     PSHBOTH XAR0
    02c9e7:   5095                     PSHBOTH XAR1
    02c9e9:   50a5                     PSHBOTH XAR2
    02c9eb:   50b5                     PSHBOTH XAR3
    02c9ed:   50c5                     PSHBOTH XAR4
    02c9ef:   3845                     PSH T0,T1
    02c9f1:   b514_98                  PSH mmap(@AC0G)
    02c9f4:   5005                     PSHBOTH AC0
    02c9f6:   b51a_98                  PSH mmap(@AC1G)
    02c9f9:   5015                     PSHBOTH AC1
    02c9fb:   b54c_98                  PSH mmap(@AC2G)
    02c9fe:   5025                     PSHBOTH AC2
    02ca00:   b554_98                  PSH mmap(@AC3G)
    02ca03:   5035                     PSHBOTH AC3
    02ca05:   b574_98                  PSH mmap(@BRS1)
    02ca08:   b572_98                  PSH mmap(@BRC1)
    02ca0b:   dc06b0_98                BTST #11,mmap(@ST1_55),TC1
    02ca0f:   46b3                     BSET ST1_INTM
    02ca11:   b51e_98                  PSH mmap(@TRN0)
    02ca14:   b588_98                  PSH mmap(@RPTC)
    02ca17:   b532_98                  PSH mmap(@BK03)
    02ca1a:   b534_98                  PSH mmap(@BRC0)
    02ca1d:   b54e_98                  PSH mmap(@CDP)
    02ca20:   b556_98                  PSH mmap(@DPH)
    02ca23:   ec319e00002e             AMAR *(#0002eh),XAR1
    02ca29:   4c0a                     RPT #10
    02ca2b:   b723                     PSH dbl(*AR1+)
    02ca2d:   90a9                     MOV XAR2,XAR1
    02ca2f:   9674                     XCC !TC1
    02ca31:   46b2                     BCLR ST1_INTM
    02ca33:   b59e_98                  PSH mmap(@CDPH)
    02ca36:   50d5                     PSHBOTH XAR5
    02ca38:   448d                     MOV SP,AR5
    02ca3a:   f49afffe_98              AND #65534,mmap(@SP)
    02ca3f:   ed318f006c16             MOV dbl(*(#06c16h)),XAR0
    02ca45:   9081                     MOV XAR0,AC1
    02ca47:   9040                     MOV XSP,AC0
    02ca49:   2601                     SUB AC0,AC1
    02ca4b:   66a1                     BCC #0x02ca5a,AC1 < #0
    02ca4d:   ed318f006c1a             MOV dbl(*(#06c1ah)),XAR0
    02ca53:   9081                     MOV XAR0,AC1
    02ca55:   2601                     SUB AC0,AC1
    02ca57:   043118                   BCC #0x02ca72,AC1 <= #0
    02ca5a:   eb3145006c12             MOV XSP,dbl(*(#06c12h))
    02ca60:   eb3155006c14             MOV XSSP,dbl(*(#06c14h))
    02ca66:   ed314f006c16             MOV dbl(*(#06c16h)),XSP
    02ca6c:   ed315f006c18             MOV dbl(*(#06c18h)),XSSP
    02ca72:   f71100016bee             ADD #1,*abs16(#06beeh)
    02ca78:   f71100016c1e             ADD #1,*abs16(#06c1eh)
    02ca7e:   f86e0600_98              MPYMK mmap(@BIOS),#6,AC0
    02ca83:   2209                     MOV AC0,AR1
    02ca85:   ec318e006af4             AMAR *(#06af4h),XAR0
    02ca8b:   2498                     ADD AR1,AR0
    02ca8d:   a000_98                  MOV mmap(@IER0),AC0
    02ca90:   a18a_98                  MOV mmap(@IER1),AC1
    02ca93:   a90d0002                 MOV *AR0(#0002h),AR1
    02ca97:   3699                     NOT AR1,AR1
    02ca99:   d90099_98                AND mmap(@IER0),AR1,AR1
    02ca9d:   c900_98                  MOV AR1,mmap(@IER0)
    02caa0:   a90d0003                 MOV *AR0(#0003h),AR1
    02caa4:   3699                     NOT AR1,AR1
    02caa6:   d98a99_98                AND mmap(@IER1),AR1,AR1
    02caaa:   c98a_98                  MOV AR1,mmap(@IER1)
    02caad:   46b2                     BCLR ST1_INTM
    02caaf:   a90d0002                 MOV *AR0(#0002h),AR1
    02cab3:   3890                     PSH AR1,AC0
    02cab5:   a90d0003                 MOV *AR0(#0003h),AR1
    02cab9:   3891                     PSH AR1,AC1
    02cabb:   ed0d080000               MOV dbl(*AR0(#0000h)),AC0
    02cac0:   a80d0004                 MOV *AR0(#0004h),AR0
    02cac4:   9200                     CALL AC0
    02cac6:   3a89                     POP AR0,AR1
    02cac8:   46b3                     BSET ST1_INTM
    02caca:   20                       NOP
    02cacb:   20                       NOP
    02cacc:   20                       NOP
    02cacd:   20                       NOP
    02cace:   20                       NOP
    02cacf:   20                       NOP
    02cad0:   2898                     AND AR1,AR0
    02cad2:   da8a88_98                OR mmap(@IER1),AR0,AR0
    02cad6:   c88a_98                  MOV AR0,mmap(@IER1)
    02cad9:   3a89                     POP AR0,AR1
    02cadb:   2898                     AND AR1,AR0
    02cadd:   da0088_98                OR mmap(@IER0),AR0,AR0
    02cae1:   c800_98                  MOV AR0,mmap(@IER0)
    02cae4:   f711ffff6bee             ADD #-1,*abs16(#06beeh)
    02caea:   f711ffff6c1e             ADD #-1,*abs16(#06c1eh)
    02caf0:   f011ffff6bee             CMP *abs16(#06beeh) == #-1, TC1
    02caf6:   6d7400a0                 BCC #0x02cb9a,!TC1
    02cafa:   a8116bed                 MOV *abs16(#06bedh),AR0
    02cafe:   d711886bec               SUB *abs16(#06bech),AR0,AR0
    02cb03:   6d280093                 BCC #0x02cb9a,AR0 < #0
    02cb07:   e611006bee               MOV #0,*abs16(#06beeh)
    02cb0c:   46b2                     BCLR ST1_INTM
    02cb0e:   ed11086be8               MOV dbl(*abs16(#06be8h)),AC0
    02cb13:   9200                     CALL AC0
    02cb15:   46b3                     BSET ST1_INTM
    02cb17:   20                       NOP
    02cb18:   20                       NOP
    02cb19:   20                       NOP
    02cb1a:   20                       NOP
    02cb1b:   20                       NOP
    02cb1c:   20                       NOP
    02cb1d:   a8116bed                 MOV *abs16(#06bedh),AR0
    02cb21:   d711886bec               SUB *abs16(#06bech),AR0,AR0
    02cb26:   04582a                   BCC #0x02cb53,AR0 >= #0
    02cb29:   ed318f006c16             MOV dbl(*(#06c16h)),XAR0
    02cb2f:   9081                     MOV XAR0,AC1
    02cb31:   9040                     MOV XSP,AC0
    02cb33:   2610                     SUB AC1,AC0
    02cb35:   04105d                   BCC #0x02cb95,AC0 != #0
    02cb38:   ed314f006c12             MOV dbl(*(#06c12h)),XSP
    02cb3e:   ed315f006c14             MOV dbl(*(#06c14h)),XSSP
    02cb44:   eb3108006c12             MOV AC0,dbl(*(#06c12h))
    02cb4a:   eb3108006c14             MOV AC0,dbl(*(#06c14h))
    02cb50:   060042                   B #0x02cb95
    02cb53:   20                       NOP
    02cb54:   20                       NOP
    02cb55:   20                       NOP
    02cb56:   20                       NOP
    02cb57:   20                       NOP
    02cb58:   46a2                     BCLR ST1_M40
    02cb5a:   ed318f006c16             MOV dbl(*(#06c16h)),XAR0
    02cb60:   9081                     MOV XAR0,AC1
    02cb62:   9040                     MOV XSP,AC0
    02cb64:   2601                     SUB AC0,AC1
    02cb66:   66a1                     BCC #0x02cb75,AC1 < #0
    02cb68:   ed318f006c1a             MOV dbl(*(#06c1ah)),XAR0
    02cb6e:   9081                     MOV XAR0,AC1
    02cb70:   2601                     SUB AC0,AC1
    02cb72:   04311d                   BCC #0x02cb92,AC1 <= #0
    02cb75:   eb3145006c12             MOV XSP,dbl(*(#06c12h))
    02cb7b:   eb3155006c14             MOV XSSP,dbl(*(#06c14h))
    02cb81:   20                       NOP
    02cb82:   20                       NOP
    02cb83:   20                       NOP
    02cb84:   20                       NOP
    02cb85:   20                       NOP
    02cb86:   ed314f006c16             MOV dbl(*(#06c16h)),XSP
    02cb8c:   ed315f006c18             MOV dbl(*(#06c18h)),XSSP
    02cb92:   06ff77                   B #0x02cb0c
    02cb95:   e611ff6bee               MOV #-1,*abs16(#06beeh)
    02cb9a:   ed3108006c12             MOV dbl(*(#06c12h)),AC0
    02cba0:   040027                   BCC #0x02cbca,AC0 == #0
    02cba3:   ed318f006c16             MOV dbl(*(#06c16h)),XAR0
    02cba9:   9081                     MOV XAR0,AC1
    02cbab:   9040                     MOV XSP,AC0
    02cbad:   2610                     SUB AC1,AC0
    02cbaf:   041018                   BCC #0x02cbca,AC0 != #0
    02cbb2:   ed314f006c12             MOV dbl(*(#06c12h)),XSP
    02cbb8:   ed315f006c14             MOV dbl(*(#06c14h)),XSSP
    02cbbe:   eb3108006c12             MOV AC0,dbl(*(#06c12h))
    02cbc4:   eb3108006c14             MOV AC0,dbl(*(#06c14h))
    02cbca:   52d8                     MOV AR5,SP
    02cbcc:   9048                     MOV XSP,XAR0
    02cbce:   a00d002f                 MOV *AR0(#002fh),AC0
    02cbd2:   7d0f2b00                 AND #3883,AC0,AC0
    02cbd6:   a908_98                  MOV mmap(@ST3_55),AR1
    02cbd9:   7df0d499                 AND #61652,AR1,AR1
    02cbdd:   2a09                     OR AC0,AR1
    02cbdf:   c90d002f                 MOV AR1,*AR0(#002fh)
    02cbe3:   a00d0031                 MOV *AR0(#0031h),AC0
    02cbe7:   7dcfff00                 AND #53247,AC0,AC0
    02cbeb:   a906_98                  MOV mmap(@ST1_55),AR1
    02cbee:   7d300099                 AND #12288,AR1,AR1
    02cbf2:   2a09                     OR AC0,AR1
    02cbf4:   c90d0031                 MOV AR1,*AR0(#0031h)
    02cbf8:   50d4                     POPBOTH XAR5
    02cbfa:   dc06b0_98                BTST #11,mmap(@ST1_55),TC1
    02cbfe:   46b3                     BSET ST1_INTM
    02cc00:   bb9e_98                  POP mmap(@CDPH)
    02cc03:   20                       NOP
    02cc04:   20                       NOP
    02cc05:   20                       NOP
    02cc06:   20                       NOP
    02cc07:   20                       NOP
    02cc08:   ec319e000042             AMAR *(#00042h),XAR1
    02cc0e:   4c0a                     RPT #10
    02cc10:   b825                     POP dbl(*AR1-)
    02cc12:   90a9                     MOV XAR2,XAR1
    02cc14:   9674                     XCC !TC1
    02cc16:   46b2                     BCLR ST1_INTM
    02cc18:   bb56_98                  POP mmap(@DPH)
    02cc1b:   bb4e_98                  POP mmap(@CDP)
    02cc1e:   bb34_98                  POP mmap(@BRC0)
    02cc21:   bb32_98                  POP mmap(@BK03)
    02cc24:   bb88_98                  POP mmap(@RPTC)
    02cc27:   bb1e_98                  POP mmap(@TRN0)
    02cc2a:   bb72_98                  POP mmap(@BRC1)
    02cc2d:   bb74_98                  POP mmap(@BRS1)
    02cc30:   5034                     POPBOTH AC3
    02cc32:   bb54_98                  POP mmap(@AC3G)
    02cc35:   5024                     POPBOTH AC2
    02cc37:   bb4c_98                  POP mmap(@AC2G)
    02cc3a:   5014                     POPBOTH AC1
    02cc3c:   bb1a_98                  POP mmap(@AC1G)
    02cc3f:   5004                     POPBOTH AC0
    02cc41:   bb14_98                  POP mmap(@AC0G)
    02cc44:   3a45                     POP T0,T1
    02cc46:   50c4                     POPBOTH XAR4
    02cc48:   50b4                     POPBOTH XAR3
    02cc4a:   50a4                     POPBOTH XAR2
    02cc4c:   5094                     POPBOTH XAR1
    02cc4e:   5084                     POPBOTH XAR0
    02cc50:   bb08_98                  POP mmap(@ST3_55)
    02cc53:   20                       NOP
    02cc54:   20                       NOP
    02cc55:   20                       NOP
    02cc56:   20                       NOP
    02cc57:   20                       NOP
    02cc58:   20                       NOP
    02cc59:   4805                     RETI

  • Ah yes, BIOS interrupts are different than the C compiler's idea of "interrupt"; they are not compatible.  This makes this a thorny problem.

    Your workaround of placing .switch on the single page is probably the only practical solution at this point.

    I'm going to have to ponder this a while.

  • Thanks for your reply.  Yes this is worrying.  So far we seem to be running fine with the .switch section remapped.   Given that the chip, compiler and BIOS are not new and heavily used it does not seem likely that this has many more hazards, but we would be interested if TI did an analysis of further implications.

  • Hello,

         We see considerable code in the TI DSP libraries for the C55xx processor that use the XARn register for temporary storage and is plainly not meant to be small model compatible.   We would like to know if DSP/BIOS small library could be modifed to force the XARn upper 7 bits to the .bss data page as done with the C compiler version of an interrupt handler.   Might this not be considerd an RTOS small model bug?    This would allow our DSP code to also use the XARn registers for temporary storage.  

    Thanks

    Tim

  • DSP/BIOS for the 55x is not being actively developed.

    The only workaround that I can think of would be to disable interrupts before changing XARn and restoring XARn back to the original state prior to reenable of interrupts.

    Thanks,
    -Karl-