Forum Discussion
Altera_Forum
Honored Contributor
19 years agouninitialized mem locations problem
Hullo, I am newbie to Nios.
I have a custom board - not relevant to current question. Nios2 6.1, no d-cache, 512byte i-cache, 16k onchip-mem with program running (mem address 0x100000-0x13FFFF), cfi-flash mem to boot from. Me very bad in programming. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif Using alt_main at the moment. When simulating RTL-level in Modelsim, I have a problem with a memory location, stack entry, which is never written but is being read once in a while. Eventually it ends up with giving bad address, something like110d0: d9c03017 ldw r7,192(sp) // reads uninitialized value from 0x13f6c to r7
...
11b48: 3b400015 stw r13,0(r7) // stores to bad address When using altsyncram model as a program memory this usually gives me 0x0 read from stack, and later some variable is stored to address 0x0. When (for the sake of simulation) I initialize altsyncram randomly, it gives some random value. Text section is ok, since it is copied from flash. The problem seems to dissappear if I use d-cache (not sure though, have to check more carefully), but I still would like to clarify that point. Please explain me, what I am doing wrong with my soft. Thanks.1 Reply
- Altera_Forum
Honored Contributor
update
I have changed a function slightly, previously it was that a pointer is passed to function, which writes some data there, then "main" reads the data from the pointer and uses it. Now I changed function so that with this particular call the function returns the value directly rather than with the pointer passed. And it works OK. The problem is gone, but its unclear nature still worries me. Anyone faced that situation?