Building emWin library

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

Building emWin library

2,076 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Tue Aug 27 07:51:21 MST 2013
Hi
So I'm progressing with a makefile for a simple program to use the hello world example of emWin. Before I add anything emWin related, my board running a LPC1788 succesfully outputs to serial, blinks an led and FreeRTOS works.

I needed to add the config files from the library, so I added this to my makefile
MYSOURCES += $(wildcard $(EMWIN)/emWin522_library/Config/*.c)
MYOBJS_DIR = build/$(CHIP)/obj
OBJS = $(MYSOURCES) $(MYOBJS_DIR)/$(STARTUP).o $(EXTRA_OBJS)

I then got an error saying that it cant find I2C.h
I2C.h and others are in the HW folder from the emWin522BSP folder, so I copy them to another location and add that also to my make file:
MYSOURCES += $(wildcard $(EMWIN)/emWin522_library/HW/*.c)
I also added that folder to my includes, although Im not sure that was the right thing to do:
INCLUDES += -I$(EMWIN)/emWin522_library/HW

This gets rid of the error about I2C succesffully. My HW folder now contains:
HWConf.c  HWConf.h  I2C.c  I2C.h  I2C_PCA9532.c  I2C_PCA9532.h  LPC177x_8x.h  system_LPC177x_8x.h

I think Im getting there.
Im getting a bunch of errors though, that are probably because there are still files that I need to include, however I cant quite tell what the mistake is.

Can anyone point me as to what is causing these errors:

../emWin522/emWin522_library/Config/LCDConf.c: In function '_SSP_Send':
../emWin522/emWin522_library/Config/LCDConf.c:566:16: warning: variable 'Dummy' set but not used [-Wunused-but-set-variable]
../emWin522/emWin522_library/HW/HWConf.c: In function '_EMC_Init':
../emWin522/emWin522_library/HW/HWConf.c:331:16: warning: variable 'Dummy' set but not used [-Wunused-but-set-variable]
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o: In function `__StackTop':
(.stack+0x200): multiple definition of `__StackTop'
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o:(.stack+0x200): first defined here
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o: In function `__StackLimit':
/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: multiple definition of `__StackLimit'
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o:/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: first defined here
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o: In function `__HeapBase':
/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: multiple definition of `__HeapBase'
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o:/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: first defined here
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o: In function `__HeapLimit':
(.heap+0x400): multiple definition of `__HeapLimit'
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o:(.heap+0x400): first defined here
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o: In function `__isr_vector':
/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: multiple definition of `__isr_vector'
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o:/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: first defined here
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o: In function `Reset_Handler':
/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: multiple definition of `Reset_Handler'
build/CHIP_LPC177X_8X/obj/startup_ARMCM3.o:/home/amlwwalker/Documents/lpcopen-make/main/../startup_ARMCM3.S:277: first defined here
/opt/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: world.elf section `.GUI_RAM' will not fit in region `RAM'
/opt/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: region RAM overflowed with stack
/opt/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: region `RAM' overflowed by 13288996 bytes
/tmp/ccqyi4Me.o: In function `_InitSSP':
/home/amlwwalker/Documents/lpcopen-make/main/../emWin522/emWin522_library/Config/LCDConf.c:553: undefined reference to `PeripheralClock'
/tmp/ccqyi4Me.o: In function `LCD_X_Config':
/home/amlwwalker/Documents/lpcopen-make/main/../emWin522/emWin522_library/Config/LCDConf.c:1463: undefined reference to `PeripheralClock'
/tmp/ccqyi4Me.o: In function `_ExecutePCA9532Cmd':
/home/amlwwalker/Documents/lpcopen-make/main/../emWin522/emWin522_library/Config/LCDConf.c:939: undefined reference to `PeripheralClock'
/tmp/ccSk6ChG.o: In function `HW_X_Config':
/home/amlwwalker/Documents/lpcopen-make/main/../emWin522/emWin522_library/HW/HWConf.c:108: undefined reference to `SystemCoreClockUpdate'
/tmp/ccSk6ChG.o: In function `__low_level_init':
/home/amlwwalker/Documents/lpcopen-make/main/../emWin522/emWin522_library/HW/HWConf.c:486: undefined reference to `SystemCoreClockUpdate'
collect2: error: ld returned 1 exit status
make: *** [world.elf] Error 1



Thanks
Alex
Labels (1)
0 Kudos
Reply
6 Replies

1,949 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Tue Sep 03 12:03:25 MST 2013
Hi Wouter,
Struggling a bit with the LCD stuff, cant quite tell what I need to change for my lcd. Whats the variable _Windows aswell? I see in some of the functions that are only compiled if that variable is set some of the code that initialises the connections to the LCD. I cant however see it set anywhere.
The other thing I was going to ask, is I dont think it uses lpcopen. If I want to use that, am I doubling up on code libraries, or can I just use it somehow?
0 Kudos
Reply

1,949 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Thu Aug 29 07:37:07 MST 2013
Alex,

Most likely you will need to adapt two things:
- LCD configuration. The BSP read the EEPROM present on the LCD board of the EA kit, which is not present on your dev board. You'd need to remove the code reading the I2C EEPROM, and hardcode the LCD config data. Most (all?) of the related code is in LCDConf.c. If you study this file, your LCD datasheet, the porting guide I mentioned to you in another thread and the LPC1788 user manual, you should be able to figure it out.
- EMC configuration. Since the framebuffer is too big to fit in internal SRAM, it resides in external SDRAM. The external SDRAM is memory mapped to the CPU using the External Memory Controller (EMC). The EMC must be configured according to how the SDRAM is connected and the timing parameters of the SDRAM. It can be somewhat tricky to get it working if you're new to it, so I'd advise you to try to get a working EMC config example designed for your board and simply use that one. In the emWin BSP, the EMC init can be found in the HWConf.c file.

Regards,
Wouter
0 Kudos
Reply

1,949 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Wed Aug 28 12:16:19 MST 2013
Right thanks Wouter,
Im not sure, I must have got an old version or something, I dont think I had changed it in any way. Anyway, it now compiles and creates a .hex file, which means I can flash the chip successfully.

I dont get anything on the lcd, which probably means that its not setup for my lcd. At the moment Im not sure how to set it up for my lcd. It is the same chip as the one in the code so in that respect I shouldnt have to change much I dont think. Is it just LCDConf.c I need to change? Where can I find one specific for my LCD? Or should it not be a problem as the LPC1788 has an on board LCD driver, and thats all the code needs to care about?

Is there an easy way to get it to output something out of uart0 so that I can see if anything is working?
0 Kudos
Reply

1,949 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Wed Aug 28 00:18:04 MST 2013
Hi Alex,

Seems like you did not import the unmodified BSP, since the BSP does not have a src/main.c, and the main.c which is present in the BSP has no reference to curTicks...
If you've download the BSP, executed the installer and extracted the resulting .zip file, you'd simply import the NXP_emWin522_BSP\Start folder to LPCXpresso. Compiling should succeed (I just checked to be 100% about that). I you do get errors, make sure you have the latest LPCXpresso and that you are working from a clean workspace.

To generate a .hex file in LPCXpresso:
- Right-click on your project (i.e. NXP_EA1788_emWinBSP_Xpresso510), choose properties.
- C/C++ Build->Settings->Build Steps. Replace "Post-build steps Command" with:
  arm-none-eabi-size ${BuildArtifactFileName}; arm-none-eabi-objcopy -O ihex ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.hex ;

Regards,
Wouter
0 Kudos
Reply

1,949 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Tue Aug 27 11:40:27 MST 2013
Hi Wouter,
OK sounds like I should do that.
But can I make a .hex with LPCXpresso?
I have a JTAG but I dont think it works with LPCXpresso - you need ones specifically for it dont you?

EDIT:
Imported to LPCXPresso, changed build steps to uncomment so that it now should produce a .hex file. I get the following errors:

../src/main.c:23:1: error: stray '\342' in program
../src/main.c:23:1: error: stray '\200' in program
../src/main.c:23:1: error: stray '\223' in program
../src/main.c:23:21: error: expected ')' before 'curTicks'
../src/main.c:19:10: warning: variable 'curTicks' set but not used [-Wunused-but-set-variable]
../src/main.c: In function 'LED_Config':
../src/main.c:31:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIODIR'
../src/main.c: In function 'LED_On':
../src/main.c:39:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIOPIN'
../src/main.c: In function 'LED_Off':
../src/main.c:47:11: error: 'LPC_GPIO_TypeDef' has no member named 'FIOPIN'
make: *** [src/main.o] Error 1

I havent touched the code, so I dont understand why things like those stray \342 would be ins there
0 Kudos
Reply

1,949 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Tue Aug 27 08:12:11 MST 2013
Hi Alex,

The emWin BSPs are based on the (older) PDL, your makefile is meant for LPCOpen. These two can't be mixed. You should either port the BSP to make use of LPCOpen(i.e. NOT add "emWin522_library/HW" to your sources, but use the LPCOpen implementation instead), or adjust your makefile to use the PDL instead of LPCOpen.

We currently don't have an LPC1788 LPCOpen emWin example, but we do have an LPC4300 LPCOpen emWin example. If you are going to port the BSP to make use of LPCOpen, this might be an example on how to do it.

I know you don't like to use an IDE as I recommended you before, but please reconsider; with LPCXpresso you can simply import the LPC1788 emWin BSP, compile and program. Within minutes you'll have emWin running! There are not many people out here working on makefiles, so support is very limited. Of course it's your decision in the end, but I'm just trying to make your life easier ;)

Regards,
Wouter
0 Kudos
Reply