Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - paulk

Pages: 1 2 [3]
Luminary Micro TM LM3SXXXX / Re: Simulator vs. GCC
« on: November 19, 2009, 07:58:02 PM »
You're right.  My fault, I don't know where I got the $3k from (Looking at too many numbers over the last 12 hours...)  ;)

I haven't tried Crossworks or Code-Red.  I was quite happy that I had a "working" solution with CS GCC, but I'm starting to see the benefit of going a commercial route.  We're still testing the waters on the feasibility of the devices, toolchains, etc, etc, but we may make the plunge at some point.  As an aside, I can't stand Eclipse.  I know everyone uses it, and there must be a learning curve, and once you figure it out, its probably great, but I find it terribly unintuitive.

I'm curious: what is the approximate code penalty for implementing a sprintf function with floats in Crossworks?


Luminary Micro TM LM3SXXXX / Re: Overlapping Sectors when building.
« on: November 19, 2009, 05:39:22 PM »
I don't have too much to add here, other than wanting to understand these errors myself.

What's strange is that the .rodata and .text sections seem to be starting at very low offsets (thereby causing the overlaps).  Can you attach your .ld script?

Luminary Micro TM LM3SXXXX / Re: Simulator vs. GCC
« on: November 19, 2009, 04:17:49 PM »
Hi Mark,

Thanks for the continued support and fast responses.

I do realize that this is a GCC issue, and I now know (and appreciate) why you use non-library versions of functions specifically in uTasker (uMalloc, uStrlen, etc).

At one point I was able to compile the code (although it didn't actually work), and the difference in code size was at least 20k.  I consider that to be excessive for one function.  Perhaps Rowley's implementation is better but at $3,000 for a commercial license, I consider that excessive too.

I have relegated myself to the fact of writing my own ftoa function (once it is cleaned up, I will post it here).  I found a few pre-written snippets on-line, but I found that they clobbered the numbers by doing multiplications and divisions.  I will then try to use the StellarisWare version of sprintf (simplified, no float support), in conjunction with my ftoa routine (ie: convert float to string, and then use it within sprintf).

The funny part is that the stuff that should be hard (ie: ethernet, filesystem, http, ftp) has been made a breeze using your tools, and the stuff that I've taken for granted (converting numbers to strings) has been a minor nightmare.  I spent way too much time on that problem last night (as my "Total time logged in" would prove!! :))

However, the upside is that I've learned a lot (still much much much more to go)!

As an aside, it would be satisfying (although probably irrelevant to my problem now) to figure this whole malloc() thing out.  I'm using the "arm-none-eabi-gcc.exe (Sourcery G++ Lite 2009q3-68) 4.4.1" version of the CS GCC Lite.

It appears to be missing the libnosys.a (which likely would solve the issue??), and when implementing my own _sbrk function, I got the linker error above about the .ARM.exidx. overlap.

Luminary Micro TM LM3SXXXX / Re: Simulator vs. GCC
« on: November 19, 2009, 04:12:29 AM »
As an update, I tried toying with the suggestions in this thread:

But I have a lot of problems:

1) NULL was not defined anywhere.  I fixed this by setting a #define NULL 0
2) I adjusted the HEAPSIZE to 8192 as suggested
3) Code STILL wouldn't gave me error as follows:
Code: [Select]
..../ld.exe: section .ARM.exidx loaded at [00000000,00000007] overlaps section .vectors loaded at [00000000,00000007]4) I changed the .vectors section in the uTaskerLM3SXXXX.ld file to start at offset 0x00000008 instead.
5) This worked (code compiled), however loading it onto board caused it to not function
6) I removed the call to sprintf, and reverted the .vectors section to offset 0x0000000.  I compiled (successfully) the code, but left the _srbk function inside the application.c file.  However, with this bin, the board wouldn't work either...!!!

So I'm officially stuck, tired and out of ideas.  I need an efficient way to print float numbers, but this seemingly simple task is a major roadblock at this point.

Any ideas would be appreciated.

Luminary Micro TM LM3SXXXX / Re: Simulator vs. GCC
« on: November 19, 2009, 02:48:08 AM »
Thanks Mark,

Unfortunately, sprintf does use malloc(), and as a result requires the syscalls, which CodeSourcery GCC doesn't seem to provide...or not that I can find.  I've read mention of including libnosys.a, but I can't find such a file.

Additionally, going this route seems like tremendous overkill, and it sounds like the code bloat from this approach is previous 8-bit experience showed that it was manageable, so I'm a little frustrated that this is so difficult, given the greater processing power here.  According to this post:,com_joomlaboard/Itemid,/func,view/catid,8/id,409/#409

In the case of the luminary version, it is almost 30k!!!!!

However, I'm not sure how to implement libnosys (-lnosys).  I've tried adding it in the linker in the makefile, but it fails (it says it can't find it), and a search through all the directories doesn't list it either.  This was a rather old post, so I'm not sure if maybe they removed it.

I'm a little confused though.  It looks like these functions (srbk, etc), are expected to exist in the operating system.  However, the CodeSourcery GCC toolchain is designed for processors without any OS, so how are these functions supposed to work?

My concern is that I don't want to screw up the memory management that uTasker is doing, with the "malloc" requirements of a single function (sprintf).  I'd accept implementing my own sprintf (or even ftoa), but I can't find one that seems to work.  Many of the ftoa functions butcher the numbers because of multiplication and division routines.

Luminary Micro TM LM3SXXXX / Re: Simulator vs. GCC
« on: November 19, 2009, 12:11:37 AM »
Hi Mark,

Thanks for the followup.  I've been researching this issue all day.  I will experiment with adding the stub file information myself.  I expect however that the sprintf function will cause considerable code bloat (although in my experience with 8-bit micros, it was acceptable in some cases where quick formatting was required).  I was hoping that this type of thing would be straight-forward, but as luck would have it, sometimes the seemingly simple things end up being the hardest.

Can you comment on uTasker + LM parts with floating point numbers?  I will require some FP math (simple add/subtract/multiply/divide).  But I will need a method to print those numbers.  I can do without sprintf for floats (ie: try to use a simpler implementation such as the usprintf included with StellarisWare, but how would I convert float to string?

Luminary Micro TM LM3SXXXX / Re: Simulator vs. GCC
« on: November 18, 2009, 06:39:30 PM »
Thanks Martin,

I did end up coming across those threads after-the-fact, but I'm glad you sent me the link to the functions, as I hadn't seen that.

I typically avoid use of (s)printf functions, coming from an 8-bit micro background, but they do have their place, and can make coding life much easier in some circumstances. (I've used them successfully and extensively in 8-bit processors).

I also came across a few links with regards to this issue specific to Luminary Micro and CodeSourcery GCC.  It looks like the srbk function can cause issues:

There is even an "Urban Dictionary" entry for this  ;D

Interestingly enough I found some documentation on the fact in some of the GCC literature installed with the CodeSourcery GCC, under the "syscalls.html" file.

/CodeSourcery/Sourcery G++ Lite/share/doc/arm-arm-none-eabi/html/libc/Syscalls.html

It goes on to mention that you may need to provide "Stubs" of certain code to enable the links to libc. 

I wonder if there are pre-written "stub" files for this task.  I will try to avoid using the (s)printf functions, but as I said, in some cases they are useful eg: printing floating point numbers.  Which functions do you recommend for this task?

Luminary Micro TM LM3SXXXX / Include files in .bin
« on: November 18, 2009, 03:49:43 PM »
Is there a way to generate a .bin file with the auxiliary files included inside it?  ie: I'd like to do my testing/debugging on the simulator, and upload files via FTP, etc. and then have the compiled output include all the htm/jpg/etc files that I've included.  This way I don't have to manually upload them later.

Luminary Micro TM LM3SXXXX / Simulator vs. GCC
« on: November 18, 2009, 03:45:40 PM »
I'm making progress in learning uTasker, but I'm having problems with the seemingly "simple" stuff.

I'm playing with dynamic web content (in terms of fnInsertString).  I took the advice to remove all the stuff from the sample fnInsertString function (webinterface.c) and start replacing it with what I need.  So far, I have the following:

Code: [Select]
if(!TxLength)  //simple string field
    case 'N':  //insert STRING
  uStrcpy(&cValue, "Test");
case 'I':  
  *usLengthToSend=sprintf(&cValue, "%u", uTaskerSystemTick);

      return cValue;

I want the "£vI" directive to write the system tick value.  The above code works fine in the simulator, but when I try to compile it using GCC, it dies with a bunch of warnings and errors.  Specifically, it doesn't like the sprintf call.  Here are some of the warnings / errors:

Code: [Select]
C:\dev\uTasker\Applications\uTaskerV1.4\GNU_LM3SXXXX>cs-make -f make_uTaskerV1.4_GNU_LM3SXXXX all
arm-none-eabi-gcc -mcpu=cortex-m3 -mlittle-endian -mthumb -Wall -Wstrict-prototypes -I../../uTaskerV1.4 -D _GNU -D _LM3SXXXX -g -c -Os ../webInterface
.c -o Build/webInterface.o
../webInterface.c: In function 'fnInsertString':
../webInterface.c:646: warning: implicit declaration of function 'sprintf'
../webInterface.c:646: warning: incompatible implicit declaration of built-in function 'sprintf'
../webInterface.c:646: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'UTASK_TICK'

The warnings I generally understand, but where it dies is during linking I think, with the following:
Code: [Select]
arm-none-eabi-gcc -mcpu=cortex-m3 -mlittle-endian -mthumb -Wall -Wstrict-prototypes -I../../uTaskerV1.4 -D _GNU -D _LM3SXXXX -g -Os -Wl,-Map=uTaskerV1 --no-gc-sections -nostartfiles -TuTaskerLM3SXXXX.ld -o uTaskerV1.4.elf Build/application.o Build/debug.o Build/webInterface.o Build/KeyScan.o B
uild/CGLCD.o Build/OLED.o Build/LCD.o Build/NetworkIndicator.o Build/usb_application.o Build/LM3SXXXX.o Build/MODBUS.o Build/modbus_app.o Build/GLCD.o
 Build/eth_drv.o Build/Driver.o Build/uMalloc.o Build/uTasker.o Build/Tty_drv.o Build/iic_drv.o Build/USB_drv.o Build/uFile.o Build/Watchdog.o Build/G
lobalTimer.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/snmp.o Build/tcp.o Build/telnet.o Build/tftp.o Build/udp.o Build/webutils.o Build/NetBIOS.o
c:/dev/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/bin/ld.exe: section .ARM.exidx loaded at [00000000,
00000007] overlaps section .vectors loaded at [00000000,00000007]
c:/dev/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-sbrkr.o): In function `_sbr
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'
collect2: ld returned 1 exit status
cs-make: *** [uTaskerV1.4.elf] Error 1

If I take out the sprintf, it works.

I have tried adding stdio.h to webinterface.c, but that didn't work.  So, can I use sprintf?  Is there a list of functions that I can/can't use?  Are all standard C functions ie: via (stdio, stdlib) supported?

My research on the internet tells me that sprintf probably uses malloc(), and malloc in turn calls this "_sbrk" function which doesn't exist. 

Luminary Micro TM LM3SXXXX / uTasker & LM parts
« on: November 13, 2009, 03:37:18 AM »
Just a quick question regarding how interchangeable the LM3Sxxxx parts are between each other.

I have a LM3s6965 dev board, but I'm trying to see which other chips within that similar family I can use.  Other than FLASH limitations, is it fairly straightforward to compile the same code over various chips?  ie: some chips have more than one SSI port, etc.....will it be fairly straight forward to compensate for this, and compile for these various chips if we move up/down in the family.

Basically, can the GNU compiler (and uTasker) work for all the 6000 series LM chips?

Luminary Micro TM LM3SXXXX / Timers
« on: November 06, 2009, 10:53:33 PM »
I'm trying to wrap my head around all this wonderful stuff, so I apologize if my question is dumb or easily answered.  I've been reading the uTasker documents including the timer document as it would relate to my project.

On top of adding web server, file system, etc connectivity, my project requires a highly accurate task to run at exact intervals.  In my previous implementation (without on operating system), I've used high priority interrupts.  Basically, I need a task to happen exacly 8192 times in 1 hour (3600s / 8192 = 439.453125 ms)....with as much accuracy as possible.  This task should fire and preempt anything else happening if possible.

Now, I know the LM6965 has 32-bit hardware timers, so presuming they count at 50Mhz (the LM6965 datasheet doesn't mention anything about pre-scalers for 32-bit timers??!?), it would yield a 0.02us period resolution.  If I'm doing my math right (and my assumptions are correct), this means that using a 32-bit timer, it could count to 85.899 my requirement of 439ms would give me great resolution on top of adequate timer size.

Reading through the uTasker header files however appears that it only uses 16-bit timers.

Basically, I'm wondering if someone could kick me in the right direction:
a) Can uTasker use a dedicated 32-bit timer for high priority, high-resolution tasks?
b) Which documents should I digest to move in this direction?
c) Which header files and which defines are required for this to happen?


Thanks for the excellent support!

Your suggestion to comment out the "#define IRQ_TEST" worked!  My LM3S6965 board has a white OLED display (It is a revision "D" board that I purchased about 3 months ago).

The display seems to work well, although it clips on the dev board (but appears to "wrap" around on the simulator).  Regardless, it is working.

Luminary Micro TM LM3SXXXX / Web "Admin" page demo
« on: October 30, 2009, 10:43:53 PM »
Just FYI (thought it might help someone),

When going through the tutorial for the LM3Sxxxx (using 6965 eval board), I found that the "Admin" page wasn't working (ie: changing the values, and pressing "Do Action" did nothing.

It turns out that the Kadmin.htm page is missing the <form> tag for the action form.  I uploaded the Kadmin.htm page from this page:, and it works.

Does this mean that the EK-LM3S6965 eval board OLED should work now?  When I have SUPPORT_GLCD and OLED_GLCD_MODE defined, the simulator shows a black box where the LCD usually is.  Also, the OLED is bank on the eval board.

Any tricks to get this working?

µTasker general / Troubles with uTasker Simulator (Unhandled Exception)
« on: October 30, 2009, 08:16:09 PM »
First, let me say hello!  I'm new to the world of highly embedded, powerful microprocessors, and am exited to use a tool like uTasker to discover it.

I'm running the tutorial for the LM3Sxxxx parts.  Everything is going well, but I ran into a hitch with the simulator.  Basically, it works, and I can ping, http, and FTP to the simulator, but when I do an FTP "dir" command, it crashes with the following error:

When I hit "break", it takes me to the line with the "while" loop in the following code:
Code: [Select]
static USER_FILE *fnNextUserFile(USER_FILE *ptrFiles, MAX_FILE_LENGTH *FileLength, unsigned char *ucMimeType)
    while ((ptrFiles != 0) && (ptrFiles->fileName != 0)) {
        if (ptrFiles->ucProperties & FILE_INVISIBLE) {
            ptrFiles++;                                                  // jump the invisible file
        *FileLength = ptrFiles->file_length;
        *ucMimeType = ptrFiles->ucMimeType;
        return ptrFiles;
    return 0;                                                            // no more user files

Any ideas?  I took out the "dir" statements from the file referenced to by the .bat file, but I'd like to trace this problem.

Pages: 1 2 [3]