Problem in Migrating Keil USBMem code (LPC2368) to IAR

I’m trying to migrate Keil USBMem code (LPC2368) to IAR version.

However, it gots compiling error in the following USB Interrupt Service Routine.

Is there any syntax or setting need to modify in the IAR?

Please help. Thank you very much.

// declaration in usbhw.h

extern void USB_ISR (void) __irq;

// source code in usbhw.c

void USB_ISR (void) __irq {

DWORD disr, val, n, m;

disr = DEV_INT_STAT; /* Device Interrupt Status */

DEV_INT_CLR = disr; /* A known issue on LPC214x */

}

And what is the text of the error message?

Thanks.

It seems that the “__irq” should be put in front of the function name.

However, there is another compiling problem.

In the orginal code from Keil, there is a statement in usbcore.c:

(BYTE *)pD += ((USB_CONFIGURATION_DESCRIPTOR *)pD)->wTotalLength;

but when it put to IAR, it will generate a compiling error as follow:

Error[Pe137]: expression must be a modifiable lvalue

How to solve this?

Thank you very much.

An lvalue is the left side of an equation. For some reason IAR does not think that the (BYTE *)pD is posible to modify. Is it defined as a const? Does it point to a read only variable? How is it defined?