EmbeddedRelated.com
Forums
Memfault Beyond the Launch

bootloader in C

Started by Thomas Baier August 16, 2004
Well, it was the CRTSCTS option that causes my problem. So I cut it out and
now everything works fine.

Thanks for your help

Thomas
On 2004-08-17, Andrew Jackson <alj@nospam.com> wrote:
> >> [Again, assuming you mean DSR.]
> Mea culpa: I was thinking of the system connected seeing DCD > being asserted which is really DSR on the modem.
No, DCD on the PC is is DCD on the modem. It's an output from the data set and an input to the data terminal. DCD, DSR and DTR are three different signals.
> You also used to be able to take a lock on the port by > creating a magic file but that maybe showing my age ( which is > also why I referred to /dev/ttys0 and /dev/ttyS0 :-) ).
There still is a convention of applications creating lock files under /var/lock for mutually exclusive access to serial ports. -- Grant Edwards grante Yow! How many retired at bricklayers from FLORIDA visi.com are out purchasing PENCIL SHARPENERS right NOW??
Thomas,

this is probably not what you want to hear or read but why writing a
bootloader in "C". It does not get a lot closer to hardware than a
bootloader and the programming language of choice should be assembler.
I do know the basic internal bootloader of the C164 and it is less
than 50 lines of assembly code. If you want to tell the micro on a
register level what to do, C is probably the wrong tool!?

Sorry if you consider this post non-constructive but I have been in
the embedded software businee for a long time and there are many times
when to use "C" and a few time when to use assembly language.

Cheers, Schwob


Thomas Baier <thomas@tho-bai.de> wrote in message news:<412219ed$0$28834$9b4e6d93@newsread4.arcor-online.net>...
> Andrew Jackson wrote: > > >> int comport = openport("/dev/ttyS0"); > > Aside from Gary's comment, do you mean "/dev/ttys0" (no DTR)? Or does your > > microcontroller have a full set of control lines? > > > > Andrew > > Hmmm, I tried /dev/ttys0 and got an error while writing, so I think I should > use /dev/ttyS0 instead. I also tried /dev/cua0, but that doesn't work, too. > What I expected as I found out that /dev/ttyS0 and /dev/cua0 should be the > same device, aren't they? > What exactly is DTR? I google a bit and found out that "the DTR signal is > generated by your workstation and tells the computer or device on the other > end that you are ready (a space voltage) or not-ready (a mark voltage). DTR > is usually enabled automatically whenever you open the serial interface on > the workstation." > What does that mean for me? How can I find out if my microcontroller does > have a full set of control lines? But wouldn't all the other thinks (like > transferring hex and vm-codes to an existing OS) I'm already able to do > work, if that is the problem? > > @Gary: > >>write(comport,0,1); > >This looks suspicious. > > What exactly looks suspicious at this line? How to do it in the correct way? > I tried > unsigned char handshake = 0; > int ret = write(sfd,&handshake,1); > but that doesn't work, too and as I think it is really the same, isn't it? > > > > Thanks for your help > > Thomas
On 2004-08-17, Schwob <schwobus@aol.com> wrote:

> this is probably not what you want to hear or read but why > writing a bootloader in "C".
Nobody said he was. The "C" code we're talking about runs on a Linux system and talks to the bootloader via a serial port. Did you really think his he was using Linux as the OS for a bootloader? -- Grant Edwards grante Yow! I like the IMPUDENT at NOSE on that car... Are you visi.com a TEEN-AGER?
Schwob wrote:
> Thomas, > > this is probably not what you want to hear or read but why writing a > bootloader in "C". It does not get a lot closer to hardware than a > bootloader and the programming language of choice should be assembler. > I do know the basic internal bootloader of the C164 and it is less > than 50 lines of assembly code. If you want to tell the micro on a > register level what to do, C is probably the wrong tool!? > > Sorry if you consider this post non-constructive but I have been in > the embedded software businee for a long time and there are many times > when to use "C" and a few time when to use assembly language. >
[...] I wrote a secondary loader for C167 in C. It works quite well, thank you. I also wrote the Linux code that loads the main program in the C167. I only mention this because there was ___no___ examplary existent code. The C167 "community" is "you're on your own". ------------------------------------------------------------ Creepy, Soulless Gigolo for President ? NOT ! --------------------------------------------- THK is one weird, weird something.
Well, what Grant said is correct. I only use C for the routines on my PC to
transfer my assembler routines to the microcontroller. And if you haven't
read my POST from yesterday, I'd like to say it again: IT WORKS!!! :-) And
thanks again for your help on finding my mistake.

Greetings

Thomas

Memfault Beyond the Launch