Skip to content

Commit 229ce2c

Browse files
committed
Add cortex-a9 and cortex-a15 targets.
1 parent ef75be0 commit 229ce2c

6 files changed

Lines changed: 186 additions & 28 deletions

File tree

Makefile.arm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# ifeq logical or
2+
ifeq ($(CORE), $(filter $(CORE),CORTEXA9 CORTEXA15))
3+
CCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a
4+
FCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a
5+
endif
16

27
ifeq ($(CORE), ARMV7)
38
CCOMMON_OPT += -marm -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a

cpuid_arm.c

Lines changed: 67 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,27 @@
3030
#define CPU_UNKNOWN 0
3131
#define CPU_ARMV6 1
3232
#define CPU_ARMV7 2
33-
#define CPU_CORTEXA15 3
33+
#define CPU_CORTEXA9 3
34+
#define CPU_CORTEXA15 4
3435

3536
static char *cpuname[] = {
3637
"UNKOWN",
3738
"ARMV6",
3839
"ARMV7",
40+
"CORTEXA9",
3941
"CORTEXA15"
4042
};
4143

4244

45+
static char *cpuname_lower[] = {
46+
"unknown",
47+
"armv6",
48+
"armv7",
49+
"cortexa9",
50+
"cortexa15"
51+
};
52+
53+
4354
int get_feature(char *search)
4455
{
4556

@@ -85,6 +96,29 @@ int detect(void)
8596
char buffer[512], *p;
8697
p = (char *) NULL ;
8798

99+
infile = fopen("/proc/cpuinfo", "r");
100+
while (fgets(buffer, sizeof(buffer), infile))
101+
{
102+
103+
if (!strncmp("CPU part", buffer, 8))
104+
{
105+
p = strchr(buffer, ':') + 2;
106+
break;
107+
}
108+
}
109+
110+
fclose(infile);
111+
if(p != NULL) {
112+
if (strstr(p, "0xc09")) {
113+
return CPU_CORTEXA9;
114+
}
115+
if (strstr(p, "0xc15")) {
116+
return CPU_CORTEXA15;
117+
}
118+
119+
}
120+
121+
p = (char *) NULL ;
88122
infile = fopen("/proc/cpuinfo", "r");
89123

90124
while (fgets(buffer, sizeof(buffer), infile))
@@ -142,21 +176,7 @@ void get_architecture(void)
142176
void get_subarchitecture(void)
143177
{
144178
int d = detect();
145-
switch (d)
146-
{
147-
148-
case CPU_ARMV7:
149-
printf("ARMV7");
150-
break;
151-
152-
case CPU_ARMV6:
153-
printf("ARMV6");
154-
break;
155-
156-
default:
157-
printf("UNKNOWN");
158-
break;
159-
}
179+
printf("%s", cpuname[d]);
160180
}
161181

162182
void get_subdirname(void)
@@ -170,6 +190,36 @@ void get_cpuconfig(void)
170190
int d = detect();
171191
switch (d)
172192
{
193+
case CPU_CORTEXA9:
194+
printf("#define CORTEXA9\n");
195+
printf("#define HAVE_VFP\n");
196+
printf("#define HAVE_VFPV3\n");
197+
if ( get_feature("neon")) printf("#define HAVE_NEON\n");
198+
if ( get_feature("vfpv4")) printf("#define HAVE_VFPV4\n");
199+
printf("#define L1_DATA_SIZE 32768\n");
200+
printf("#define L1_DATA_LINESIZE 32\n");
201+
printf("#define L2_SIZE 1048576\n");
202+
printf("#define L2_LINESIZE 32\n");
203+
printf("#define DTB_DEFAULT_ENTRIES 128\n");
204+
printf("#define DTB_SIZE 4096\n");
205+
printf("#define L2_ASSOCIATIVE 4\n");
206+
break;
207+
208+
case CPU_CORTEXA15:
209+
printf("#define CORTEXA15\n");
210+
printf("#define HAVE_VFP\n");
211+
printf("#define HAVE_VFPV3\n");
212+
if ( get_feature("neon")) printf("#define HAVE_NEON\n");
213+
if ( get_feature("vfpv4")) printf("#define HAVE_VFPV4\n");
214+
printf("#define L1_DATA_SIZE 32768\n");
215+
printf("#define L1_DATA_LINESIZE 32\n");
216+
printf("#define L2_SIZE 1048576\n");
217+
printf("#define L2_LINESIZE 32\n");
218+
printf("#define DTB_DEFAULT_ENTRIES 128\n");
219+
printf("#define DTB_SIZE 4096\n");
220+
printf("#define L2_ASSOCIATIVE 4\n");
221+
break;
222+
173223

174224
case CPU_ARMV7:
175225
printf("#define ARMV7\n");
@@ -206,18 +256,7 @@ void get_libname(void)
206256
{
207257

208258
int d = detect();
209-
switch (d)
210-
{
211-
212-
case CPU_ARMV7:
213-
printf("armv7\n");
214-
break;
215-
216-
case CPU_ARMV6:
217-
printf("armv6\n");
218-
break;
219-
220-
}
259+
printf("%s", cpuname_lower[d]);
221260
}
222261

223262

getarch.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,36 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
727727
#else
728728
#endif
729729

730+
#ifdef FORCE_CORTEXA9
731+
#define FORCE
732+
#define ARCHITECTURE "ARM"
733+
#define SUBARCHITECTURE "CORTEXA9"
734+
#define SUBDIRNAME "arm"
735+
#define ARCHCONFIG "-DCORTEXA9 " \
736+
"-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
737+
"-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
738+
"-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
739+
"-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
740+
#define LIBNAME "cortexa9"
741+
#define CORENAME "CORTEXA9"
742+
#else
743+
#endif
744+
745+
#ifdef FORCE_CORTEXA15
746+
#define FORCE
747+
#define ARCHITECTURE "ARM"
748+
#define SUBARCHITECTURE "CORTEXA15"
749+
#define SUBDIRNAME "arm"
750+
#define ARCHCONFIG "-DCORTEXA15 " \
751+
"-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
752+
"-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
753+
"-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
754+
"-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
755+
#define LIBNAME "cortexa9"
756+
#define CORENAME "CORTEXA9"
757+
#else
758+
#endif
759+
730760
#ifdef FORCE_ARMV6
731761
#define FORCE
732762
#define ARCHITECTURE "ARM"

kernel/arm/KERNEL.CORTEXA15

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include $(KERNELDIR)/KERNEL.ARMV7

kernel/arm/KERNEL.CORTEXA9

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include $(KERNELDIR)/KERNEL.ARMV7

param.h

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,88 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22062206

22072207

22082208

2209+
#ifdef CORTEXA9
2210+
#define SNUMOPT 2
2211+
#define DNUMOPT 2
2212+
2213+
#define GEMM_DEFAULT_OFFSET_A 0
2214+
#define GEMM_DEFAULT_OFFSET_B 0
2215+
#define GEMM_DEFAULT_ALIGN 0x03fffUL
2216+
2217+
#define SGEMM_DEFAULT_UNROLL_M 4
2218+
#define SGEMM_DEFAULT_UNROLL_N 4
2219+
2220+
#define DGEMM_DEFAULT_UNROLL_M 4
2221+
#define DGEMM_DEFAULT_UNROLL_N 4
2222+
2223+
#define CGEMM_DEFAULT_UNROLL_M 2
2224+
#define CGEMM_DEFAULT_UNROLL_N 2
2225+
2226+
#define ZGEMM_DEFAULT_UNROLL_M 2
2227+
#define ZGEMM_DEFAULT_UNROLL_N 2
2228+
2229+
#define SGEMM_DEFAULT_P 128
2230+
#define DGEMM_DEFAULT_P 128
2231+
#define CGEMM_DEFAULT_P 96
2232+
#define ZGEMM_DEFAULT_P 64
2233+
2234+
#define SGEMM_DEFAULT_Q 240
2235+
#define DGEMM_DEFAULT_Q 120
2236+
#define CGEMM_DEFAULT_Q 120
2237+
#define ZGEMM_DEFAULT_Q 120
2238+
2239+
#define SGEMM_DEFAULT_R 12288
2240+
#define DGEMM_DEFAULT_R 8192
2241+
#define CGEMM_DEFAULT_R 4096
2242+
#define ZGEMM_DEFAULT_R 4096
2243+
2244+
2245+
2246+
#define SYMV_P 16
2247+
#endif
2248+
2249+
2250+
#ifdef CORTEXA15
2251+
#define SNUMOPT 2
2252+
#define DNUMOPT 2
2253+
2254+
#define GEMM_DEFAULT_OFFSET_A 0
2255+
#define GEMM_DEFAULT_OFFSET_B 0
2256+
#define GEMM_DEFAULT_ALIGN 0x03fffUL
2257+
2258+
#define SGEMM_DEFAULT_UNROLL_M 4
2259+
#define SGEMM_DEFAULT_UNROLL_N 4
2260+
2261+
#define DGEMM_DEFAULT_UNROLL_M 4
2262+
#define DGEMM_DEFAULT_UNROLL_N 4
2263+
2264+
#define CGEMM_DEFAULT_UNROLL_M 2
2265+
#define CGEMM_DEFAULT_UNROLL_N 2
2266+
2267+
#define ZGEMM_DEFAULT_UNROLL_M 2
2268+
#define ZGEMM_DEFAULT_UNROLL_N 2
2269+
2270+
#define SGEMM_DEFAULT_P 128
2271+
#define DGEMM_DEFAULT_P 128
2272+
#define CGEMM_DEFAULT_P 96
2273+
#define ZGEMM_DEFAULT_P 64
2274+
2275+
#define SGEMM_DEFAULT_Q 240
2276+
#define DGEMM_DEFAULT_Q 120
2277+
#define CGEMM_DEFAULT_Q 120
2278+
#define ZGEMM_DEFAULT_Q 120
2279+
2280+
#define SGEMM_DEFAULT_R 12288
2281+
#define DGEMM_DEFAULT_R 8192
2282+
#define CGEMM_DEFAULT_R 4096
2283+
#define ZGEMM_DEFAULT_R 4096
2284+
2285+
2286+
2287+
#define SYMV_P 16
2288+
#endif
2289+
2290+
22092291

22102292
#ifdef GENERIC
22112293

0 commit comments

Comments
 (0)