Change from 32 to 8 arithmetic in a security application

Hi! How do a change a security application done with 32 bits arithmetic to

8 bits arithmetic. It was build for a PC, but a want to use it in a microcontroller. What do I need to change, think about.....? The application is done in C

Regards Ulf Reiman

Reply to
Ulf Reiman
Loading thread data ...

Hi! How do a change a security application done with 32 bits arithmetic to

8 bits arithmetic. It was build for a PC, but a want to use it in a microcontroller. What do I need to change, think about.....? The application is done in C

Regards Ulf Reiman

Reply to
Ulf Reiman

I think compiler will worry about that. There are instruction like add with carry and substract with cary which can make it possible.

Reply to
Mad I.D.

The biggest issues are probably determining the amount of memory you require, what the speed requirements are, what the I/O requirements are, and how you are going to build a system with a microcontroller.

If the C code was written with portability in mind, compiling it for a

8-bit microcontroller may be straight-forward. There are many possible issues to be addressed if the code was not written with portability in mind. Your I/O will change, though.
--
Thad
Reply to
Thad Smith

Huh?

in C , asm, Pacal?

If 32 bit math is required, You must do it as 32 bits. Otherwise, Look at all equations an variables and determine the minimum size the can be while still giving the correct results.

Reply to
Neil

You should also check how the compiler for the 8 bit processor stores values larger than 8 bits. If it uses big-endian notation and since PC programs use little-endian notation, there may be some big/little endian problems, if overlapping data structures (such as unions) are used.

Paul

Reply to
Paul Keinanen

Why not just do it in a 32 bit microcontroller. The Philips ARMS for instance start at under US$2 in quantity and you can get one with 512K of Flash for under US$5.

Cheers, Alf

Reply to
Alf Katz

Ulf Reiman schrieb:

Hello,

you should look first for the supported data types which may be used with this compiler and microcontroller. Are there only 8 bit integer, or are there also 16 or even 32 bits integer? Requires the application only 32 bit unsigned integers or also signed ones? What operations are used and are they supported? Add, subtract, multiply, divide, and, or, shift...?

If necessary you may define small functions for all needed operations with 32 bits. It may be easier in assembler to use the add with carry instructions, but you should write assembler subroutines which may be called from c code.

Bye

Reply to
Uwe Hercksen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.