Skip to content

Commit 92d770f

Browse files
committed
Update Zephyr MSDK Hal based on MSDK PR: analogdevicesinc/msdk#1179
1 parent 395841b commit 92d770f

File tree

4 files changed

+232
-1
lines changed

4 files changed

+232
-1
lines changed

MAX/Libraries/CMSIS/Device/Maxim/MAX32655/Source/heap.c

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <stdint.h>
2222
#include <errno.h>
2323
#include <unistd.h>
24+
#include <malloc.h>
2425

2526
/*
2627
sbrk
@@ -48,3 +49,79 @@ caddr_t _sbrk(int incr)
4849

4950
return (caddr_t)prev_heap_end;
5051
}
52+
53+
// struct mallinfo {
54+
// size_t arena; /* total space allocated from system */
55+
// size_t ordblks; /* number of non-inuse chunks */
56+
// size_t smblks; /* unused -- always zero */
57+
// size_t hblks; /* number of mmapped regions */
58+
// size_t hblkhd; /* total space in mmapped regions */
59+
// size_t usmblks; /* unused -- always zero */
60+
// size_t fsmblks; /* unused -- always zero */
61+
// size_t uordblks; /* total allocated space */
62+
// size_t fordblks; /* total non-inuse space */
63+
// size_t keepcost; /* top-most, releasable (via malloc_trim) space */
64+
// };
65+
66+
/*
67+
The structure fields contain the following information:
68+
69+
arena The total amount of memory allocated by means other than
70+
mmap(2) (i.e., memory allocated on the heap). This figure
71+
includes both in-use blocks and blocks on the free list.
72+
73+
ordblks
74+
The number of ordinary (i.e., non-fastbin) free blocks.
75+
76+
smblks The number of fastbin free blocks (see mallopt(3)).
77+
78+
hblks The number of blocks currently allocated using mmap(2).
79+
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
80+
81+
hblkhd The number of bytes in blocks currently allocated using
82+
mmap(2).
83+
84+
usmblks
85+
This field is unused, and is always 0. Historically, it
86+
was the "highwater mark" for allocated space—that is, the
87+
maximum amount of space that was ever allocated (in
88+
bytes); this field was maintained only in nonthreading
89+
environments.
90+
91+
fsmblks
92+
The total number of bytes in fastbin free blocks.
93+
94+
uordblks
95+
The total number of bytes used by in-use allocations.
96+
97+
fordblks
98+
The total number of bytes in free blocks.
99+
100+
keepcost
101+
The total amount of releasable free space at the top of
102+
the heap. This is the maximum number of bytes that could
103+
ideally (i.e., ignoring page alignment restrictions, and
104+
so on) be released by malloc_trim(3).
105+
*/
106+
107+
struct mallinfo mallinfo(void)
108+
{
109+
struct mallinfo temp_mallinfo;
110+
111+
if (heap_end == 0) {
112+
heap_end = (caddr_t)&__HeapBase;
113+
}
114+
115+
temp_mallinfo.arena = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
116+
temp_mallinfo.ordblks = 0; /* Unused */
117+
temp_mallinfo.smblks = 0; /* Unused */
118+
temp_mallinfo.hblks = 0; /* Unused */
119+
temp_mallinfo.hblkhd = 0; /* Unused */
120+
temp_mallinfo.usmblks = 0; /* Unused */
121+
temp_mallinfo.fsmblks = 0; /* Unused */
122+
temp_mallinfo.uordblks = (size_t)heap_end - (size_t)&__HeapBase;
123+
temp_mallinfo.fordblks = (size_t)&__HeapLimit - (size_t)heap_end;
124+
temp_mallinfo.keepcost = 0 /* Unused */;
125+
126+
return temp_mallinfo;
127+
}

MAX/Libraries/CMSIS/Device/Maxim/MAX32665/Source/heap.c

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <stdint.h>
2222
#include <errno.h>
2323
#include <unistd.h>
24+
#include <malloc.h>
2425

2526
/*
2627
sbrk
@@ -48,3 +49,79 @@ caddr_t _sbrk(int incr)
4849

4950
return (caddr_t)prev_heap_end;
5051
}
52+
53+
// struct mallinfo {
54+
// size_t arena; /* total space allocated from system */
55+
// size_t ordblks; /* number of non-inuse chunks */
56+
// size_t smblks; /* unused -- always zero */
57+
// size_t hblks; /* number of mmapped regions */
58+
// size_t hblkhd; /* total space in mmapped regions */
59+
// size_t usmblks; /* unused -- always zero */
60+
// size_t fsmblks; /* unused -- always zero */
61+
// size_t uordblks; /* total allocated space */
62+
// size_t fordblks; /* total non-inuse space */
63+
// size_t keepcost; /* top-most, releasable (via malloc_trim) space */
64+
// };
65+
66+
/*
67+
The structure fields contain the following information:
68+
69+
arena The total amount of memory allocated by means other than
70+
mmap(2) (i.e., memory allocated on the heap). This figure
71+
includes both in-use blocks and blocks on the free list.
72+
73+
ordblks
74+
The number of ordinary (i.e., non-fastbin) free blocks.
75+
76+
smblks The number of fastbin free blocks (see mallopt(3)).
77+
78+
hblks The number of blocks currently allocated using mmap(2).
79+
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
80+
81+
hblkhd The number of bytes in blocks currently allocated using
82+
mmap(2).
83+
84+
usmblks
85+
This field is unused, and is always 0. Historically, it
86+
was the "highwater mark" for allocated space—that is, the
87+
maximum amount of space that was ever allocated (in
88+
bytes); this field was maintained only in nonthreading
89+
environments.
90+
91+
fsmblks
92+
The total number of bytes in fastbin free blocks.
93+
94+
uordblks
95+
The total number of bytes used by in-use allocations.
96+
97+
fordblks
98+
The total number of bytes in free blocks.
99+
100+
keepcost
101+
The total amount of releasable free space at the top of
102+
the heap. This is the maximum number of bytes that could
103+
ideally (i.e., ignoring page alignment restrictions, and
104+
so on) be released by malloc_trim(3).
105+
*/
106+
107+
struct mallinfo mallinfo(void)
108+
{
109+
struct mallinfo temp_mallinfo;
110+
111+
if (heap_end == 0) {
112+
heap_end = (caddr_t)&__HeapBase;
113+
}
114+
115+
temp_mallinfo.arena = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
116+
temp_mallinfo.ordblks = 0; /* Unused */
117+
temp_mallinfo.smblks = 0; /* Unused */
118+
temp_mallinfo.hblks = 0; /* Unused */
119+
temp_mallinfo.hblkhd = 0; /* Unused */
120+
temp_mallinfo.usmblks = 0; /* Unused */
121+
temp_mallinfo.fsmblks = 0; /* Unused */
122+
temp_mallinfo.uordblks = (size_t)heap_end - (size_t)&__HeapBase;
123+
temp_mallinfo.fordblks = (size_t)&__HeapLimit - (size_t)heap_end;
124+
temp_mallinfo.keepcost = 0 /* Unused */;
125+
126+
return temp_mallinfo;
127+
}

MAX/Libraries/CMSIS/Device/Maxim/MAX32690/Source/heap.c

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <stdint.h>
2222
#include <errno.h>
2323
#include <unistd.h>
24+
#include <malloc.h>
2425

2526
/*
2627
sbrk
@@ -48,3 +49,79 @@ caddr_t _sbrk(int incr)
4849

4950
return (caddr_t)prev_heap_end;
5051
}
52+
53+
// struct mallinfo {
54+
// size_t arena; /* total space allocated from system */
55+
// size_t ordblks; /* number of non-inuse chunks */
56+
// size_t smblks; /* unused -- always zero */
57+
// size_t hblks; /* number of mmapped regions */
58+
// size_t hblkhd; /* total space in mmapped regions */
59+
// size_t usmblks; /* unused -- always zero */
60+
// size_t fsmblks; /* unused -- always zero */
61+
// size_t uordblks; /* total allocated space */
62+
// size_t fordblks; /* total non-inuse space */
63+
// size_t keepcost; /* top-most, releasable (via malloc_trim) space */
64+
// };
65+
66+
/*
67+
The structure fields contain the following information:
68+
69+
arena The total amount of memory allocated by means other than
70+
mmap(2) (i.e., memory allocated on the heap). This figure
71+
includes both in-use blocks and blocks on the free list.
72+
73+
ordblks
74+
The number of ordinary (i.e., non-fastbin) free blocks.
75+
76+
smblks The number of fastbin free blocks (see mallopt(3)).
77+
78+
hblks The number of blocks currently allocated using mmap(2).
79+
(See the discussion of M_MMAP_THRESHOLD in mallopt(3).)
80+
81+
hblkhd The number of bytes in blocks currently allocated using
82+
mmap(2).
83+
84+
usmblks
85+
This field is unused, and is always 0. Historically, it
86+
was the "highwater mark" for allocated space—that is, the
87+
maximum amount of space that was ever allocated (in
88+
bytes); this field was maintained only in nonthreading
89+
environments.
90+
91+
fsmblks
92+
The total number of bytes in fastbin free blocks.
93+
94+
uordblks
95+
The total number of bytes used by in-use allocations.
96+
97+
fordblks
98+
The total number of bytes in free blocks.
99+
100+
keepcost
101+
The total amount of releasable free space at the top of
102+
the heap. This is the maximum number of bytes that could
103+
ideally (i.e., ignoring page alignment restrictions, and
104+
so on) be released by malloc_trim(3).
105+
*/
106+
107+
struct mallinfo mallinfo(void)
108+
{
109+
struct mallinfo temp_mallinfo;
110+
111+
if (heap_end == 0) {
112+
heap_end = (caddr_t)&__HeapBase;
113+
}
114+
115+
temp_mallinfo.arena = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
116+
temp_mallinfo.ordblks = 0; /* Unused */
117+
temp_mallinfo.smblks = 0; /* Unused */
118+
temp_mallinfo.hblks = 0; /* Unused */
119+
temp_mallinfo.hblkhd = 0; /* Unused */
120+
temp_mallinfo.usmblks = 0; /* Unused */
121+
temp_mallinfo.fsmblks = 0; /* Unused */
122+
temp_mallinfo.uordblks = (size_t)heap_end - (size_t)&__HeapBase;
123+
temp_mallinfo.fordblks = (size_t)&__HeapLimit - (size_t)heap_end;
124+
temp_mallinfo.keepcost = 0 /* Unused */;
125+
126+
return temp_mallinfo;
127+
}

MAX/msdk_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
679fc79d66f0f64a4a1b323c11b98fd9117d22a2
1+
b0219d334e8b8ab3250885a7438975513cafa94d

0 commit comments

Comments
 (0)