#define change does not enable code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

#define change does not enable code

2,172 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andre Schoeman on Tue Mar 29 00:25:05 MST 2011
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]Hi[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I have an interesting problem with #defines.[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]In the usbcdc project, I have changed the file usbcfg.h [/SIZE][/FONT][/COLOR]


[LEFT][COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]#define USB_POWER_EVENT 1[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]This should enable some code in usbuser.c.c and usbhw.c [/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]for example[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]#if USB_POWER_EVENT[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]void USB_Power_Event (uint32_t power)[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]{[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]USB_Connect(TRUE); // USB Connect[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]while (!USB_Configuration); // wait until USB is configured[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]}[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]#endif[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]When USB_POWER_EVENT is 0 then these bits of code are greyed(purple) out.[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]When USB_POWER_EVENT is changed from 0 to 1 the background colour should turn white indicating that the code is once again part of the application and will be compiled.[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]This colour change is however not happening and the code appears not to be compiled.[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I have checked the following,[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I have removed the original USBCDC example code just in case my project is referencing the wrong file. I even renamed the USBCDC folder to be sure. [/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I've created examples of how this should work and it does.[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I've searched for additional #defines of USB_POWER_EVENT but can't find any.[/SIZE][/FONT][/COLOR]
[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I also renamed the function USB_Power_Event as it has the same name as the #define though this should not make a difference.[/SIZE][/FONT][/COLOR]


[COLOR=#000000][FONT=Arial, sans-serif][SIZE=2]I can obviously just discard the #if #endif completely, but I'd still like to know what the underlying problem is.[/SIZE][/FONT][/COLOR]


[FONT=Arial][SIZE=2]Has anybody seen anything like this?[/SIZE][/FONT][/LEFT]
[FONT=Arial][SIZE=2][SIZE=2]Version: LPCXpresso v3.6.2 [Build 279] [29/01/2011]
[/SIZE][/SIZE][/FONT][LEFT][FONT=Arial][SIZE=2]Andre
[/SIZE][/FONT]

[/LEFT]
0 Kudos
Reply
14 Replies

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Wed Mar 30 00:44:10 MST 2011
I kind of figured it was OE for the directory mess.:o  It was definitely done while I was in the IDE and I had only been using LPCXpresso for about a week.

It hasn't happened since.  Watching all those nice videos and reading the manuals might have saved me from myself.:)

Thanks for the replies
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Mar 30 00:30:48 MST 2011

Quote:

Is this an LPCXpresso IDE (Eclipse) problem?



I think so. Probably resolved in the next release...

Note: I'm still talking about Andre's problem.
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Mar 30 00:29:58 MST 2011
The Indexer reads the project (or workspace) source code to build an index of the variable/functions/defines/includes/etc within the project. The index is then used to provide source-code browsing features and auto-completion within the editor. Normally, the indexer runs silently in the background, maintaining the  index as you edit your source code.

It is impossible for the indexer to rearrange your projects structure. In fact, there is nothing in the IDE that would rearrange your projects structure, and therefore it must be something you did (or was done outside of the IDE).
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Wed Mar 30 00:20:24 MST 2011

Quote: Zero
It's obvious an index problem :mad:.



Is this an LPCXpresso IDE (Eclipse) problem?

I have also had an Index->Rebuild rearrange my project's directory structure and I had to create a new project to clean up the mess.  This has occurred several times and I never figured out what caused it.
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andre Schoeman on Tue Mar 29 19:39:18 MST 2011

Quote: jharwood
Right click on the project in the Project Explorer panel, then choose Index -> Rebuild



That did it.
For some reason this #define requires this action after every change.
Thanks
Andre
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Tue Mar 29 18:04:15 MST 2011

Quote: Andre Schoeman
My LPCXpresso has no option Index under Projects. I did do a clean and a complete rebuild...no joy.



Right click on the project in the Project Explorer panel, then choose Index -> Rebuild
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andre Schoeman on Tue Mar 29 17:43:57 MST 2011

Quote: Zero
It's obvious an index problem :mad:.

Workaround:

Right click on project -> Index -> Rebuild




My LPCXpresso has no option Index under Projects. I did do a clean and a complete rebuild...no joy.
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Mar 29 15:43:25 MST 2011
It's obvious an index problem :mad:.

Workaround:

Right click on project -> Index -> Rebuild
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Mar 29 15:26:17 MST 2011
Sorry, was answering Larry (USBCDC is a LPC1343 project).

LPCXpresso 1343 is "LPC1343 LPCXpresso Board".

Back to the problem:

This is a reproducible LPCXpresso v3.6.2 error, which has nothing to do with your board.
Of course changing #defines should work, but I can just confirm that this is an error.
Didn't find a workaround, so we have to wait for CodeRedSupport...
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andre Schoeman on Tue Mar 29 14:56:21 MST 2011

Quote: Zero
Try LPCXpresso1343 :)



Hi, what is LPCXpresso1343?
Do you refer to the the example code?

I am refering to the usbcdc examples provided for LPC devices. I have the LPCXpresso1343 examples too.
The usbcfg.h files I refer to come from the example code.
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Andre Schoeman on Tue Mar 29 14:54:30 MST 2011

Quote: larryvc
What board are you using?



My own based on LPC1343, but I don't see this as a board problem.
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue Mar 29 12:10:12 MST 2011
OK. I just ordered another toy!:):)
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Mar 29 10:56:04 MST 2011
Try LPCXpresso1343 :)
0 Kudos
Reply

2,160 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue Mar 29 10:31:14 MST 2011
What board are you using?
0 Kudos
Reply