Hi,
I have made a project using an LPC2148 evaluation board from sparkfun
(logomatic V2).
I think that I have a memory overflow problem because some global data
are overwrited during my program execution without any write.
Example:
Bebug output in the beginning of my program execution
1 | weekday N0 alarm: morning_en:0 afternoon_en:0
|
2 | weekday N1 alarm: morning_en:1 afternoon_en:1
|
3 | 08h:30m
|
4 | 12h:00m
|
5 | 14h:00m
|
6 | 17h:30m
|
7 | weekday N2 alarm: morning_en:1 afternoon_en:1
|
8 | 08h:30m
|
9 | 12h:00m
|
10 | 14h:00m
|
11 | 17h:30m
|
12 | weekday N3 alarm: morning_en:1 afternoon_en:1
|
13 | 08h:30m
|
14 | 12h:00m
|
15 | 14h:00m
|
16 | 17h:30m
|
17 | weekday N4 alarm: morning_en:1 afternoon_en:1
|
18 | 08h:30m
|
19 | 12h:00m
|
20 | 14h:00m
|
21 | 17h:30m
|
22 | weekday N5 alarm: morning_en:1 afternoon_en:1
|
23 | 08h:30m
|
24 | 12h:00m
|
25 | 14h:00m
|
26 | 17h:30m
|
27 | weekday N6 alarm: morning_en:1 afternoon_en:0
|
28 | 09h:00m
|
29 | 12h:00m
|
and when I read the same data later I could see that some data are
overwrited by some strange values:
1 | weekday N0 alarm: morning_en:0 afternoon_en:0
|
2 | weekday N1 alarm: morning_en:1 afternoon_en:1
|
3 | 08h:30m
|
4 | 12h:00m
|
5 | 14h:00m
|
6 | 17h:30m
|
7 | weekday N2 alarm: morning_en:1 afternoon_en:1
|
8 | 08h:30m
|
9 | 12h:00m
|
10 | 14h:00m
|
11 | 17h:30m
|
12 | weekday N3 alarm: morning_en:1 afternoon_en:1
|
13 | 08h:30m
|
14 | 12h:00m
|
15 | 14h:00m
|
16 | 17h:30m
|
17 | weekday N4 alarm: morning_en:53 afternoon_en:208
|
18 | 00h:02m
|
19 | 00h:17m
|
20 | 00h:04m
|
21 | 00h:17m
|
22 | weekday N5 alarm: morning_en:54 afternoon_en:44
|
23 | 00h:100m
|
24 | 00h:128m
|
25 | 53h:11m
|
26 | 157h:60m
|
27 | weekday N6 alarm: morning_en:28 afternoon_en:50
|
28 | 53h:248m
|
29 | 00h:04m
|
30 | 54h:220m
|
31 | 00h:100m
|
I think that the .bss section (my global data) is overwrited by the
.stack
Here is some detail:
Section Size Address
.text 75100 0001 0000
.data 2576 4000 0000
.bss 9564 4000 0A10
.stack 3072 4000 3000
in startup.s file
1 | .set UND_Stack_Size, 0x00000080
|
2 | .set SVC_Stack_Size, 0x00000080
|
3 | .set ABT_Stack_Size, 0x00000080
|
4 | .set FIQ_Stack_Size, 0x00000080
|
5 | .set IRQ_Stack_Size, 0x00000200
|
6 | .set USR_Stack_Size, 0x00000800
|
So the size of the stack (3000) is correct but I don't understand why it
start so close to the .bss section. Shouldn't be at the address 4000
8000 ?
The .bss section end at 4000 0A10 + 255C = 4000 2F6C
If the .stack data start at 4000 3000 it may collide with the .bss
section (4000 3000 - 0C00 = 4000 2400) !!
Could you help me to solve this problem?