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.

#70-D and #770-D warnings in working code

Other Parts Discussed in Thread: MSP430F5510

I have being creating a custom version of the MSPBoot (http://www.ti.com/lit/an/slaa600a/slaa600a.pdf) for MSP430F5510 devices using CCS and it is working perfectly fine.

For the ProxyVectorTable array I have the following:

#pragma DATA_SECTION(ProxyVectorTable, ".APP_PROXY_VECTORS")
#pragma RETAIN(ProxyVectorTable)
const uint16_t ProxyVectorTable[] =
{
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(0)  RTC_A
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(1)  Port2
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(2)  Timer2_A1
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(3)  Timer2_A0
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(4)  USCI_B1
	    0x4030, (uint16_t) USCI_A1_ISR,	//	APP_PROXY_VECTOR(5)  USCI_A1
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(6)  Port1
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(7)  Timer1_A1
	    0x4030, (uint16_t) TIMER1_A0_ISR,	//	APP_PROXY_VECTOR(8)  Timer1_A0
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(9)  DMA
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(10) USB_UBM
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(11) Timer0_A1
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(12) Timer0_A0
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(13) ADC10_A
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(14) USCI_B0
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(15) USCI_A0
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(16) Watchdog Timer_A
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(17) Timer0_B1
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(18) Timer0_B0
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(19) Comp_B
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(20) User NMI
	    0x4030, (uint16_t) Dummy_Isr,	//	APP_PROXY_VECTOR(21) System NMI
};

The idea is that if the application uses an ISR then the Dummy_Isr is replaced by the actual function for that ISR.

However I am getting two warnings on every single line:

1) #70-D integer conversion resulted in truncation
2) #770-D conversion from pointer to smaller integer

These warnings don't appear on the original MSPBoot source code provided by TI and I can't see any differences between my code and theirs.

Thank you,
Callum

  • Hi Callum,

    This warning seems to be caused by the vectors (20-bit address) being truncated to a 16-bit array. This is probably OK since your vectors should be located inside the first 64KB of Flash (since you are using F5510), but here are some options:

    - Change the memory model of your project (again, this shouldn't make much of a difference since you are using F5510)

    - Use #pragmas to make sure your ISRs are in the first 64KB

    - Change the array to use 32-bit addresses (might require a few other changes in the code)

    - I'm not sure if this is an option for you, but in F5xx you can relocate your vectors to RAM. This is a nice option since you don't need the software vector relocation. Check SYSCTL.SYSRIVECT for more details. 

    Regards,

    Luis R

  • Hi Luis,

    You're correct of course, that's something I should have picked up on. Anyway I tried changing the memory model but then other parts of my code were inoperable.

    I can't use #pragmas to define them in an area because I have an application space and bootloader space and the ISR area is in the bootloader space that I don't want to change when a new application is flashed therefore I would have to define the ISR for each and every interrupt even if it wasn't in use to allow compatibility.

    I also cant use 32-bit addresses because of the way that I handle interrupts and so I have simply used:

    #pragma diag_suppress 70, 770
    
    ...Code here...
    
    #pragma diag_warning 70, 770

    I know this is just a workaround but it works the way it is.

    I have had a quick look in the past at relocating the vectors into RAM but I shall look into it in more detail upon your recommendation.

    Thanks a lot,
    Callum

  • There’s another way that solves multiple problems.

    Make each table entry

     0x0080 | ((((uint32_t)Isr)>>8)&0x0F00),  ((uint32_t)Isr)&0xFFFF,

     Your real ISRs can now be anywhere in full 20 bit address range (the proxy table of course must still be in lower 64k).
    It should work with large and small code model. And should issue no warnings.

    Basically, the 0x4030 in the original code was a BRA #dst (or MOV #dst,PC) instruction, followed by the 16 bit destination address.
    The line above instead uses the BRA (MOVA) instruction, which takes a 20 bit immediate value for the destination. The upper 4 bits, however, are fused into the instruction itself.

  • Hi Jens, thank you for your reply.

    After trying what you suggested so I end up with:

    #pragma DATA_SECTION(proxyVectorTable, ".APP_PROXY_VECTORS")
    #pragma RETAIN(proxyVectorTable)
    const uint16_t proxyVectorTable[] =
    {
        (0x0080 | ((((uint32_t)Isr)>>8)&0x0F00),  ((uint32_t)Isr)&0xFFFF),
        (0x0080 | ((((uint32_t)Isr)>>8)&0x0F00),  ((uint32_t)Isr)&0xFFFF),
        (0x0080 | ((((uint32_t)Isr)>>8)&0x0F00),  ((uint32_t)Isr)&0xFFFF)
    };

    I now get two errors for each entry:
    1) #28 expression must have a constant value
    2) #58 this operator is not allowed in a constant expression

    Thanks,
    Callum

  • I see. The compiler doesn’t know the address of the ISR at compile time, and the linker can’t do the math at link time.
    Well, if you manipulate the linker script so your ISRs end up in a known memory area (0x1xxxx or 0x2xxxx), you can replace the formula with just these (then known) upper 4 bits of the ISR address:

    (0x0080 | 0x01), (uint16_t)(uint32_t)Isr,

    This should keep the compiler content and also the linker shouldn’t complain about putting a 20 bit ISR address into a 16 bit constant field.

    I don’t use IAR or CCS, so I can’t try myself.

**Attention** This is a public forum