More General Advice
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
More General Advice

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System
Author Message
dbernat32
Guest





Posted: Sat Dec 11, 2004 11:50 pm    Post subject: More General Advice Reply with quote

I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple processes
running.
I can see how you could set up a timer to switch CPU focus every so often,
but it wouldn't be adaptive to the current load. Also without protected
memory spaces, and virtual addressing wouldn't programming be like 10x as
hard and full of pitfalls and problems?

Probably the wrong forum to ask but:
Is Deffie-Hellman key exchange considered a cryptologically secure
algorthim?
Also what is the minimum CPU speed requirements for Deffie-Hellman key
exchange?
I know Blowfish is free to everyone, are Rijndael (AES), Twofish, or RC6
free?

Thanks,
David

"Remove the spam to e-mail me"
Back to top
Jack Klein
Guest





Posted: Sun Dec 12, 2004 1:00 am    Post subject: Re: More General Advice Reply with quote

On Sat, 11 Dec 2004 18:50:28 GMT, "dbernat32"
<dbernat32@gmail.spam.com> wrote in comp.arch.embedded:

Quote:
I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple processes
running.

First you need to define the term "process". While there are no
universally accepted definitions, to me the term means something like
"applications". "Processes" are what you have in a desk top or server
platform like Windows or Linux or whatever.

For example, on either platform, you might have Open Office open on a
word processing document or spread sheet, Firefox open browsing the
web, and several other applications at the same time.

Quote:
I can see how you could set up a timer to switch CPU focus every so often,
but it wouldn't be adaptive to the current load. Also without protected
memory spaces, and virtual addressing wouldn't programming be like 10x as
hard and full of pitfalls and problems?

Again, that depends on what you are doing. In the type of environment
I mentioned above, the platform has to be able to run any number of
various applications at the same time, in combinations that were never
tested together and probably never even specifically anticipated by
the operating system developers.

In this situation the simplest method is to have each different
application or process run in its own virtual machine, and isolate and
protect each one from the others.

While this is also the case in some of today's larger embedded
systems, it is not the typical case. Most embedded systems,
particularly the smaller runs, run what is essentially a single
application. Multitasking is between what would be called "threads"
in desk top environment, not actually separate processes. All of the
code in the application is designed and written together to do the
specific job.

As for how such multitasking is performed, one method is to do strict
time-slicing on timer interrupts, but there are many others, and they
do not necessarily require MMUs.

Quote:
Probably the wrong forum to ask but:
Is Deffie-Hellman key exchange considered a cryptologically secure
algorthim?
Also what is the minimum CPU speed requirements for Deffie-Hellman key
exchange?
I know Blowfish is free to everyone, are Rijndael (AES), Twofish, or RC6
free?

Sorry, can't help you with any of these.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
Back to top
Guy Macon
Guest





Posted: Sun Dec 12, 2004 1:01 am    Post subject: Re: More General Advice Reply with quote

dbernat32 wrote:

Quote:
If you use a MCU without a MMU, how exactly can you have
multiple processes running.

Lightweight multitasking works well for me.

Quote:
I can see how you could set up a timer to switch CPU focus every
so often, but it wouldn't be adaptive to the current load.

Why would you think that?

Quote:
Also without protected memory spaces, and virtual addressing
wouldn't programming be like 10x as hard and full of pitfalls
and problems?

Real Men write multitasking programs on 4-bit processors
with 256 nybbles of RAM...

Quote:
Probably the wrong forum to ask but [snip]

Wrong forum to ask. Try sci.crypt.
Back to top
Tim Wescott
Guest





Posted: Sun Dec 12, 2004 1:25 am    Post subject: Re: More General Advice Reply with quote

dbernat32 wrote:

Quote:
I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple processes
running.

You do a context switch like any other context switch -- you just don't
have protected memory spaces to save you from stupid mistakes.

Quote:
Also without protected memory spaces, and virtual addressing
wouldn't programming be like 10x as hard and full of pitfalls and
problems?

Well, this is an _embedded_ newsgroup. Embedded programming is already
10x as hard and full of pitfalls and problems. If you can't exercise
decent discipline with your program then your product is going to fail
anyway -- not having an MMU just helps you find this out during development.

Quote:
I can see how you could set up a timer to switch CPU focus every so often,
but it wouldn't be adaptive to the current load.

Modern micro kernels will do context switches on external events, to
"adapt" to the external world.

Quote:
Probably the wrong forum to ask but:

I agree with Guy on this.
Quote:



--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Back to top
Chris Giese
Guest





Posted: Sun Dec 12, 2004 7:11 am    Post subject: Re: More General Advice Reply with quote

"dbernat32" <dbernat32@gmail.spam.com> wrote:

Quote:
I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple processes
running.

1. Use threads where you would normally use tasks. Threads share the same
address space (shared code and data segment), but have different stacks.
This approach works only for static tasks/threads, rather than code
that must be loaded and unloaded at run-time.

2. If you need dynamic tasks/threads, store them in a relocatable format.
You can then load them into whatever memory is available and perform
"fixups" to make the task run correctly at the address where it's loaded:
http://my.execpc.com/~geezer/osd/exec/runreloc.zip

Quote:
Also without protected
memory spaces, and virtual addressing wouldn't programming be like 10x as
hard and full of pitfalls and problems?

Memory- and pointer-related bugs may be harder to find if you don't
have an MMU. I don't think the programming itself is any more difficult.

--
geezer@ |
execpc.com | http://my.execpc.com/~geezer
Back to top
Richard H.
Guest





Posted: Sun Dec 12, 2004 8:33 am    Post subject: Re: More General Advice Reply with quote

dbernat32 wrote:
Quote:
Also what is the minimum CPU speed requirements
for Deffie-Hellman key exchange?

Check out Applied Cryptography by Bruce Schneier. It lacks info on the
latest algorithms, but it has analysis of CPU time for many different
algorithms.
Back to top
MetalHead
Guest





Posted: Sun Dec 12, 2004 8:33 am    Post subject: Re: More General Advice Reply with quote

dbernat32 wrote:
Quote:
I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple processes
running.

The easiest and simplest way is to compile the OS and all of the
processes into one image to download or flash. This implies that all
processes are loaded all the time.

If you need to load and unload processes, the most common way is to use
position independant or PC relative coding techniques. Some compilers
offer this option. In school they talked about some other hokey tricks
to work around the problem, but I have never seen them used in the real
world.

Quote:
I can see how you could set up a timer to switch CPU focus every so often,
but it wouldn't be adaptive to the current load.

There is no connection between an MMU and the ability to change your
OS's runlist or task sequence. Added memory can be requested by tasks
from the OS dynamically (if the OS supports it), the same as in a
virtual memory environment. Dynamic memory allocation is a little
dangerous in embedded systems, because the allocation request can fail,
causing problems.

Quote:
Also without protected
memory spaces, and virtual addressing wouldn't programming be like 10x as
hard and full of pitfalls and problems?

It's not that different. The only exception to that statement is when
you get sloppy and one task corrupts the memory space of another one -
that can be ugly to find. You would not want to run a modern multiuser
OS this way, but it is common in embedded work.


Bob
Back to top
Paul Keinanen
Guest





Posted: Sun Dec 12, 2004 3:47 pm    Post subject: Re: More General Advice Reply with quote

On Sat, 11 Dec 2004 18:50:28 GMT, "dbernat32"
<dbernat32@gmail.spam.com> wrote:

Quote:
I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple processes
running.

Exactly the same way as you can run threads in some general purpose
operating systems as Linux or Windows.

Quote:
I can see how you could set up a timer to switch CPU focus every so often,

Sounds like time sharing, which was invented in the 1950/60's

Quote:
but it wouldn't be adaptive to the current load.

Just cut the time slice, if the current process does not need the
whole time slice.

Quote:
Also without protected
memory spaces, and virtual addressing wouldn't programming be like 10x as
hard and full of pitfalls and problems?

For what do you need memory protection ?
Protection against what/whom ?

In a typical embedded environment, all the applications can be
statically linked and loaded into the target system, so the addresses
for each function can be determined at compile/link time.

In a systems without memory management that needs to run multiple user
supplied processes concurrently, you need a program loader that
patches the code to run at any load address in a similar way as the
..so or .DLL libraries are loaded/relocated into the process address
space in some desktop operating systems.

Paul
Back to top
Bryan Hackney
Guest





Posted: Sun Dec 12, 2004 8:12 pm    Post subject: Re: More General Advice Reply with quote

MetalHead wrote:
Quote:
dbernat32 wrote:

I am confused about one point:
If you use a MCU without a MMU, how exactly can you have multiple
processes
running.



[...]

Quote:
If you need to load and unload processes, the most common way is to use
position independant or PC relative coding techniques. Some compilers
offer this option. In school they talked about some other hokey tricks
to work around the problem, but I have never seen them used in the real
world.

The entails runtime linking, a problem unto itself. Not something you

want to write from scratch for real work.

Quote:
I can see how you could set up a timer to switch CPU focus every so
often,
but it wouldn't be adaptive to the current load.


There is no connection between an MMU and the ability to change your
OS's runlist or task sequence. Added memory can be requested by tasks
from the OS dynamically (if the OS supports it), the same as in a
virtual memory environment. Dynamic memory allocation is a little
dangerous in embedded systems, because the allocation request can fail,
causing problems.


Yes there is a connection. How are you going to run the same image (process)
1, 10, or 1000 times?

Quote:
Also without protected
memory spaces, and virtual addressing wouldn't programming be like 10x as
hard and full of pitfalls and problems?



Not at all. Just don't expect to do what's possible and easy otherwise. The
terrain changes, and so do the solutions.

[...]
Back to top
Andreas Hadler
Guest





Posted: Sun Dec 12, 2004 8:41 pm    Post subject: Re: More General Advice Reply with quote

Bryan Hackney <bh@bhconsult.com> wrote:

Quote:
MetalHead wrote:

There is no connection between an MMU and the ability to change your
OS's runlist or task sequence. Added memory can be requested by tasks
from the OS dynamically (if the OS supports it), the same as in a
virtual memory environment. Dynamic memory allocation is a little
dangerous in embedded systems, because the allocation request can fail,
causing problems.


Yes there is a connection. How are you going to run the same image (process)
1, 10, or 1000 times?

Just as with an MMU: allocate the necessary storage in the runtime's
startup code and load a base register with it's adress. Just don't
expect this address to be the same for all instances of the same
image. If necessay, static data can be initialized by the runtime,
too.

Andreas
--
There's no time to stop for gas, we're already late.
- Karin Donker
Back to top
Elder Costa
Guest





Posted: Mon Dec 13, 2004 5:15 am    Post subject: Re: More General Advice Reply with quote

Bryan Hackney wrote:
Quote:
There is no connection between an MMU and the ability to change your
OS's runlist or task sequence. Added memory can be requested by tasks
from the OS dynamically (if the OS supports it), the same as in a
virtual memory environment. Dynamic memory allocation is a little
dangerous in embedded systems, because the allocation request can
fail, causing problems.


Yes there is a connection. How are you going to run the same image
(process)
1, 10, or 1000 times?

Perhaps by creating a
task/thread/whatever_you_call_a_lightweight_process 1, 10, 1000 times,
perhaps with different arguments (if the OS allows for it). The (RT)OS
will allocate the necessary stack space and starts the
task/thread/whatever: same code (usualy an infinite loop) with a
different data space, not necessarily protected from the other tasks
ones. At least so it was IIRC with some RTOSes such as RTKernel, AMX and
CMX some (several) years ago.

Regards.

Elder.
Back to top
Tim Wescott
Guest





Posted: Mon Dec 13, 2004 6:54 am    Post subject: Re: More General Advice Reply with quote

Elder Costa wrote:
Quote:
Bryan Hackney wrote:

There is no connection between an MMU and the ability to change your
OS's runlist or task sequence. Added memory can be requested by tasks
from the OS dynamically (if the OS supports it), the same as in a
virtual memory environment. Dynamic memory allocation is a little
dangerous in embedded systems, because the allocation request can
fail, causing problems.


Yes there is a connection. How are you going to run the same image
(process)
1, 10, or 1000 times?


Perhaps by creating a
task/thread/whatever_you_call_a_lightweight_process 1, 10, 1000 times,
perhaps with different arguments (if the OS allows for it). The (RT)OS
will allocate the necessary stack space and starts the
task/thread/whatever: same code (usualy an infinite loop) with a
different data space, not necessarily protected from the other tasks
ones. At least so it was IIRC with some RTOSes such as RTKernel, AMX and
CMX some (several) years ago.

Regards.

Elder.

Yes, this technique works quite well. I've written more than one

embedded application that controlled multiple motors with one set of
motion control code.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB