Author Topic: Issues with First Steps  (Read 9564 times)

Offline FOXY

  • Newbie
  • *
  • Posts: 6
    • View Profile
Issues with First Steps
« on: January 02, 2010, 09:20:52 PM »
Hi

I am working through the User-Guide First Steps section with Olimex LPC-P2378 board and have some comments about progress so far.

1.   It would be useful to remind complete Newbies like me not to forget #include config.h   in the new2ly created task source file (in my case martin.c which I added to the project. Spent quite a long time working out the compiler errors.

2.  the fnDebugDec(ucCounter++,0,0); statement gives a compilation error (too many parameters) . On Checking the code in device.c it has indeed only 2 paraqmeters.  I guess the .pdf needs updating with the correct code sample.

3.  There seems to be a decrepency in the #define SERIAL_PORT_0  '3' in LPC in the .pf doc.  In app-hwxxxx.h file this define expects an integer 3 rather than a char '3'  not sure if this makes a difference.

4.  I finally got a good build in DEBUG mode for the simulator but could not find any instruction as to how to get the simulted serial port to perform with UART_0 going to COM 2 on my pc using
TeraTerm.  However I did get a TELNET connection to work (also from TeraTerm), so I had a go at building for the Hardware board with the following (seemingly ambiguous message back)

1>Performing Post-Build Event...
1>arm-none-eabi-gcc -march=armv4t -mlittle-endian -mthumb -mthumb-interwork -Wall -Wstrict-prototypes -I../../uTMartin-1 -D _GNU -D _LPC23XX -g -Os -Wl,-Map=uTMartin-1.map --no-gc-sections -nostartfiles -TuTaskerLPC23XX.ld -o uTMartin-1.elf Build/application.o Build/debug.o Build/webInterface.o Build/KeyScan.o Build/LCD.o Build/TFT.o Build/NetworkIndicator.o Build/startup_gnu.o Build/LPC23XX.o Build/GLCD.o Build/MODBUS.o Build/modbus_app.o Build/eth_drv.o Build/Driver.o Build/uMalloc.o Build/uTasker.o Build/Tty_drv.o Build/iic_drv.o Build/uFile.o Build/Watchdog.o Build/GlobalTimer.o Build/low_power.o Build/Ethernet.o Build/arp.o Build/dhcp.o Build/dns.o Build/ftp.o Build/http.o Build/icmp.o Build/ip_utils.o Build/ip.o Build/pop3.o Build/smtp.o Build/tcp.o Build/telnet.o Build/tftp.o Build/udp.o Build/webutils.o Build/NetBIOS.o
1>Build/LPC23XX.o:(.rodata+0x84): undefined reference to `fnMyFirstTask'
1>collect2: ld returned 1 exit status
1>cs-make: *** [uTMartin-1.elf] Error 1
1>Build log was saved at "file://c:\APPLICATIONS\uTASKER\uTaskerV1.4_LPC\Applications\utMartin-1\Simulator\uTasker___Win32_uTasker_LPC23XX_with_GNU_build\BuildLog.htm"
1>uTMartin-1 - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

A subsequent download to the board resulted in the App running (Led Blinking) but no output on either the Serial or TELNET connections.

I guess it is because the standard 'make_uTMartin-1_GNU_LPC23XX file (a clone of the DemoProject) does not yet include my Martin.c Task file.  Some instructions for we Newbies (no previous experience with build-link-deploy chain) would be useful here.

Thanks in advance

FOXY (Martin Fox)
as I am not sure how/where/what to manually insert the necessary instructions into 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Issues with First Steps
« Reply #1 on: January 03, 2010, 12:31:31 AM »
Hi Martin

1) I have just updated the user's guide since it was for the uTasker V1.3 [ http://www.utasker.com/docs/uTasker/uTaskerV1.4_user_guide.PDF ]. There are a couple of slight changes in V1.4 which caused your problem 2. In addition I added the #include "config.h" to the example code.

Note that the code to the tutorial is available for copying at http://www.utasker.com/forum/index.php?topic=541.0, where I also adjusted it to suit V1.4 (with a couple of comments in case someone still tries using it with V1.3)

2) The fnDebugDec() routine changed in use between V1.3 and V1.4. This is explained here: http://www.utasker.com/forum/index.php?topic=641.0. Note that the string functions are fully documented in the code-documentation (not all is...) at http://www.utasker.com/docs/Code.html [open "Operating System, the "String output and Conversion"]

3) The new user's guide now shows two techniques for assigning the COM port to the simulator:

#define SERIAL_PORT_0   '3' // if we open UART channel 0 we simulate using com3 on the PC
or
#define SIM_COM_EXTENDED // this uses the value literally and not the ASCII value, which otherwise restricts to COM1..9
#define SERIAL_PORT_0   3 // if we open UART channel 0 we simulate using com3 on the PC


Both are valid but the second one (using also the define SIM_COM_EXTENDED) allows higher COM port number (especially useful with USB COM ports since they often have quite high numbers). The method with the COM port number represented as ASCII should only be used without the define. It is more for backward compatibility before the extended range was added and is limited to COM 1..9.

4) I don't think that any extra instructions are required apart from changing the 3 to 2 above. It should be all that is needed; just make sure that UART0 is really being opened in the project and then #define SERIAL_PORT_0   2 should do it (together with SIM_COM_EXTENDED of course).

GCC build:
undefined reference to `fnMyFirstTask' means that the linker didn't find this routine. You are right that it is because your new file hasn't been added to the build yet.
To avoid problems you could also simply add your new task's code to an existing file (eg. at the bottom of application.c).

But to solve it properly you need to add your file to the make file as follows:

1) Open make_uTaskerV1.4_GNU_LPC23XX
2) Add your file to the list of objects (either on a new line as below or in an existing line):

OBJS = Build/application.o Build/debug.o Build/webInterface.o Build/KeyScan.o Build/GLCD.o Build/LCD.o Build/TFT.o Build/NetworkIndicator.o \
       Build/myNewFile.o \
       Build/startup_gnu.o Build/LPC23XX.o \
       Build/MODBUS.o Build/modbus_app.o \
       Build/eth_drv.o Build/Driver.o Build/uMalloc.o Build/uTasker.o Build/Tty_drv.o Build/iic_drv.o Build/uFile.o Build/Watchdog.o Build/GlobalTimer.o Build/low_power.o \
       Build/Ethernet.o Build/arp.o Build/dhcp.o Build/dns.o Build/ftp.o Build/http.o Build/icmp.o Build/ip_utils.o Build/ip.o Build/pop3.o Build/smtp.o \
      Build/tcp.o Build/telnet.o Build/tftp.o Build/udp.o Build/webutils.o Build/NetBIOS.o


3) Add the compiler instruction by copying an similar existing one:
like
Build/webInterface.o: ../webInterface.c $(DEPENDS) ../application.h
      $(CC) $(C_FLAGS) $(INC) $(OPTS)  ../webInterface.c -o Build/webInterface.o


and changing it to suit
Build/myNewFile.o: ../myNewFile.c $(DEPENDS)
      $(CC) $(C_FLAGS) $(INC) $(OPTS)  ../myNewFile.c -o Build/myNewFile.o


{Note that I have removed the application.h dependency in this case but specific headers can be added if the C-file should be rebuild when it/they change}

That should already do it.

Note that the GCC make files as used are quite simple - there are methods to effectively automate everything but it is beyond me how it works... but it is generally also no problem to just add files when you need to and keeps it simple enough that also I more or less understand what is going on.

Note that I didn't add this to the user's guide since it is compiler specific. This thread can be used as reference for additional questions or by others needing such advice.


Thanks for the feedback and good luck

Regards

Mark



Offline FOXY

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Issues with First Steps
« Reply #2 on: January 03, 2010, 10:02:48 AM »
Thanks Mark I will work my way through it.

Btw,  I haven't used the #define OWN_TASK yet as it wasn't mentioned in the first steps guide but I notice in some other posts that other users are using it in their own code.  Should I be using it also or has it been superceeded by the other declarations in the example?

Regards

FOXY( Martin Fox)

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Issues with First Steps
« Reply #3 on: January 03, 2010, 02:05:37 PM »
Hi Martin

OWN_TASK is generally used to define the local task's name to a standard one (it helps when code is copied from one task to another since the task name doesn't need to be explicitly modified each time). It is included in the user's guide code (see page 14/19) and is also in the code source (http://www.utasker.com/forum/index.php?topic=541.0).

Therefore if you use the examples you should already be using it.

Regards

Mark