Dank der Hilfe vor einiger Zeit hier im Forum hab ich es geschafft einen
Cortex M3 von ST zum laufen zu bekommen (STF32F103)
Ich kann bisher IO-Pins toggeln und auch die Unterhaltung über RS232
geht super.
Software ist Sourcery G++ Lite for ARM EABI von CodeSourcery, sowie PN.
Das Problem das ich hab ist, dass ich wenn ich wie in der Anleitung von
Sourcery... die stdlib.h include um die Funktion rand(); zu benutzen
kann dann bleibt der Code hängen. Eigendlich wollte ich kein Roulet mit
nichts geht mehr damit erzeugen ^^
Im Anhang ist erstmal der Code der geht. (Nicht wundern der ist etwas
komisch, da er nur zum durchtesten der versch. Hardware und so ist und
noch keinen Sinn erfüllt)
Wenn ich den Code dann um #include <stdlib.h> erweitere dann geht der
Code immernoch. (hab ich getestet, kann aber sein, dass der Code einfach
wegen fehlender Aufrufe nicht rein kommt)
Sobald ich aber srand(35); noch einfüge geht der Code schon nicht mehr.
Auch nur rand(); geht nicht. - Das merkwürdige daran ist, dass der
Compiler keinerlei Fehler ausspuckt. Ich versteh beim besten willen
nicht was der mit der Funktion hat.
Sry für den Langen Text jetzt: (Auszug über rand() aus dem Sourcery
Manual)
Synopsis
1 | #include <stdlib.h>
|
2 | int rand(void);
|
3 | void srand(unsigned int seed);
|
4 | int rand_r(unsigned int *seed);
|
Description
rand returns a different integer each time it is called; each integer is
chosen by an algorithm designed to be unpredictable, so that you can use
rand when you require a random number. The algorithm depends on a static
variable called the “random seed”; starting with a given value of the
random seed always produces the same sequence of numbers in successive
calls to rand.
You can set the random seed using srand; it does nothing beyond storing
its argument in the static variable used by rand. You can exploit this
to make the pseudo-random sequence less predictable, if you wish, by
using some other unpredictable value (often the least significant parts
of a time-varying value) as the random seed before beginning a sequence
of calls to rand; or, if you wish to ensure (for example, while
debugging) that successive runs of your program use the same “random”
numbers, you can use srand to set the same random seed at the outset.
Returns
rand returns the next pseudo-random integer in sequence; it is a number
between 0 and RAND_MAX (inclusive).
srand does not return a result.
Portability
rand is required by ANSI, but the algorithm for pseudo-random number
generation is not specified; therefore, even if you use the same random
seed, you cannot expect the same sequence of results on two different
systems.
rand requires no supporting OS subroutines.
Ich frag mich natürlich jetzt woran kann es liegen und so langsam hab
ich alles durch was mir eingefallen ist. (Ich habe auch einmal den
direkten Dateipfad angegeben { #include "c:\...\stdlib.h" } , da ich
auch WinArm, sowie WinAVR drauf hab und sicher gehen wollte das es der
richtige Pfad ist hat aber auch nichts gebracht.)
Bin für Hinweise Dankbar ^^ ich schätze es ist irgend ein total dummer
Fehler bzw ich hoffe es, dass es an meiner Blödheit liegt.
Gruß ErgoProxy