Work in progress, not a stable build
This commit is contained in:
@@ -391,6 +391,7 @@ architecture behave of zpu_core_evo is
|
||||
Debug_DumpL1_1,
|
||||
Debug_DumpL1_2,
|
||||
Debug_DumpL2,
|
||||
Debug_DumpL2_0,
|
||||
Debug_DumpL2_1,
|
||||
Debug_DumpL2_2,
|
||||
Debug_DumpMem,
|
||||
@@ -533,7 +534,7 @@ architecture behave of zpu_core_evo is
|
||||
signal debugRec : zpu_dbg_t;
|
||||
signal debugLoad : std_logic; -- Load a debug record into the debug serialiser fsm, 1 = load, 0 = inactive.
|
||||
signal debugReady : std_logic; -- Flag to indicate serializer fsm is busy (0) or available (1).
|
||||
|
||||
|
||||
---------------------------------------------
|
||||
-- Functions specific to the CPU core.
|
||||
---------------------------------------------
|
||||
@@ -3223,6 +3224,10 @@ begin
|
||||
|
||||
when Debug_DumpL2 =>
|
||||
debugPC <= (others => '0');
|
||||
debugState <= Debug_DumpL2_0;
|
||||
|
||||
-- Wait state at start of dump so initial address gets registered in cache memory and data output.
|
||||
when Debug_DumpL2_0 =>
|
||||
debugState <= Debug_DumpL2_1;
|
||||
|
||||
-- Output the contents of L2 in the format <addr> <instruction ... x 20>
|
||||
|
||||
@@ -224,7 +224,7 @@ shared variable ram : ram_type :=
|
||||
159 => x"00000000",
|
||||
160 => x"71fc0608",
|
||||
161 => x"0b0b0b9f",
|
||||
162 => x"88738306",
|
||||
162 => x"cc738306",
|
||||
163 => x"10100508",
|
||||
164 => x"060b0b0b",
|
||||
165 => x"88ac0400",
|
||||
@@ -344,8 +344,8 @@ shared variable ram : ram_type :=
|
||||
279 => x"51535104",
|
||||
280 => x"80040088",
|
||||
281 => x"e2040000",
|
||||
282 => x"009fac70",
|
||||
283 => x"9fdc278b",
|
||||
282 => x"009ff070",
|
||||
283 => x"a0a0278b",
|
||||
284 => x"38807170",
|
||||
285 => x"8405530c",
|
||||
286 => x"88eb0488",
|
||||
@@ -515,14 +515,14 @@ shared variable ram : ram_type :=
|
||||
450 => x"8c085170",
|
||||
451 => x"802e8838",
|
||||
452 => x"710b0b0b",
|
||||
453 => x"9fa8340b",
|
||||
454 => x"0b0b9fa8",
|
||||
453 => x"9fec340b",
|
||||
454 => x"0b0b9fec",
|
||||
455 => x"33880c83",
|
||||
456 => x"3d0d04fa",
|
||||
457 => x"3d0d787b",
|
||||
458 => x"7d565856",
|
||||
459 => x"800b0b0b",
|
||||
460 => x"0b9fa833",
|
||||
460 => x"0b9fec33",
|
||||
461 => x"81065255",
|
||||
462 => x"82527075",
|
||||
463 => x"2e098106",
|
||||
@@ -585,7 +585,7 @@ shared variable ram : ram_type :=
|
||||
520 => x"52853d0d",
|
||||
521 => x"04f93d0d",
|
||||
522 => x"790b0b0b",
|
||||
523 => x"9fac0857",
|
||||
523 => x"9ff00857",
|
||||
524 => x"57817727",
|
||||
525 => x"80ed3876",
|
||||
526 => x"88170827",
|
||||
@@ -618,7 +618,7 @@ shared variable ram : ram_type :=
|
||||
553 => x"5574880c",
|
||||
554 => x"893d0d04",
|
||||
555 => x"fb3d0d0b",
|
||||
556 => x"0b0b9fac",
|
||||
556 => x"0b0b9ff0",
|
||||
557 => x"08fe1988",
|
||||
558 => x"1208fe05",
|
||||
559 => x"55565480",
|
||||
@@ -631,7 +631,7 @@ shared variable ram : ram_type :=
|
||||
566 => x"04fd3d0d",
|
||||
567 => x"7554800b",
|
||||
568 => x"0b0b0b9f",
|
||||
569 => x"ac087033",
|
||||
569 => x"f0087033",
|
||||
570 => x"51535371",
|
||||
571 => x"832e0981",
|
||||
572 => x"068c3894",
|
||||
@@ -644,7 +644,7 @@ shared variable ram : ram_type :=
|
||||
579 => x"880c853d",
|
||||
580 => x"0d04fc3d",
|
||||
581 => x"0d760b0b",
|
||||
582 => x"0b9fac08",
|
||||
582 => x"0b9ff008",
|
||||
583 => x"55558075",
|
||||
584 => x"23881508",
|
||||
585 => x"5372812e",
|
||||
@@ -666,7 +666,7 @@ shared variable ram : ram_type :=
|
||||
601 => x"71880c86",
|
||||
602 => x"3d0d04fa",
|
||||
603 => x"3d0d780b",
|
||||
604 => x"0b0b9fac",
|
||||
604 => x"0b0b9ff0",
|
||||
605 => x"08712281",
|
||||
606 => x"057083ff",
|
||||
607 => x"ff065754",
|
||||
@@ -840,7 +840,7 @@ shared variable ram : ram_type :=
|
||||
775 => x"04ed3d0d",
|
||||
776 => x"6559800b",
|
||||
777 => x"0b0b0b9f",
|
||||
778 => x"ac0cf59b",
|
||||
778 => x"f00cf59b",
|
||||
779 => x"3f880881",
|
||||
780 => x"06558256",
|
||||
781 => x"7482f238",
|
||||
@@ -935,11 +935,11 @@ shared variable ram : ram_type :=
|
||||
870 => x"1b0c5580",
|
||||
871 => x"0b811a34",
|
||||
872 => x"780b0b0b",
|
||||
873 => x"9fac0c80",
|
||||
873 => x"9ff00c80",
|
||||
874 => x"5675880c",
|
||||
875 => x"953d0d04",
|
||||
876 => x"ea3d0d0b",
|
||||
877 => x"0b0b9fac",
|
||||
877 => x"0b0b9ff0",
|
||||
878 => x"08558554",
|
||||
879 => x"74802e80",
|
||||
880 => x"df38800b",
|
||||
@@ -970,7 +970,7 @@ shared variable ram : ram_type :=
|
||||
905 => x"3d0d04f6",
|
||||
906 => x"3d0d7d7f",
|
||||
907 => x"7e0b0b0b",
|
||||
908 => x"9fac0859",
|
||||
908 => x"9ff00859",
|
||||
909 => x"5b5c5880",
|
||||
910 => x"7b0c8557",
|
||||
911 => x"75802e81",
|
||||
@@ -1029,42 +1029,59 @@ shared variable ram : ram_type :=
|
||||
964 => x"80577688",
|
||||
965 => x"0c8c3d0d",
|
||||
966 => x"04fb3d0d",
|
||||
967 => x"9b9086e4",
|
||||
968 => x"0b87c094",
|
||||
969 => x"8c0c9b90",
|
||||
970 => x"86e40b87",
|
||||
971 => x"c0949c0c",
|
||||
972 => x"8c80830b",
|
||||
973 => x"87c09484",
|
||||
974 => x"0c8c8083",
|
||||
975 => x"0b87c094",
|
||||
976 => x"940c9fb0",
|
||||
977 => x"51f9d63f",
|
||||
978 => x"8808b838",
|
||||
979 => x"9f9851fc",
|
||||
980 => x"df3f8808",
|
||||
981 => x"ae38a080",
|
||||
982 => x"0b880887",
|
||||
983 => x"c098880c",
|
||||
984 => x"55873dfc",
|
||||
985 => x"05538480",
|
||||
986 => x"527451fd",
|
||||
987 => x"ba3f8808",
|
||||
988 => x"8d387554",
|
||||
989 => x"73802e86",
|
||||
990 => x"38731555",
|
||||
991 => x"e439a080",
|
||||
992 => x"54730480",
|
||||
993 => x"54fb3900",
|
||||
994 => x"00ffffff",
|
||||
995 => x"ff00ffff",
|
||||
996 => x"ffff00ff",
|
||||
997 => x"ffffff00",
|
||||
998 => x"424f4f54",
|
||||
999 => x"54494e59",
|
||||
1000 => x"2e524f4d",
|
||||
1001 => x"00000000",
|
||||
1002 => x"01000000",
|
||||
967 => x"87c0948c",
|
||||
968 => x"08548784",
|
||||
969 => x"80527351",
|
||||
970 => x"ead73f88",
|
||||
971 => x"08902b87",
|
||||
972 => x"c0948c08",
|
||||
973 => x"56548784",
|
||||
974 => x"80527451",
|
||||
975 => x"eac33f73",
|
||||
976 => x"88080787",
|
||||
977 => x"c0948c0c",
|
||||
978 => x"87c0949c",
|
||||
979 => x"08548784",
|
||||
980 => x"80527351",
|
||||
981 => x"eaab3f88",
|
||||
982 => x"08902b87",
|
||||
983 => x"c0949c08",
|
||||
984 => x"56548784",
|
||||
985 => x"80527451",
|
||||
986 => x"ea973f73",
|
||||
987 => x"88080787",
|
||||
988 => x"c0949c0c",
|
||||
989 => x"8c80830b",
|
||||
990 => x"87c09484",
|
||||
991 => x"0c8c8083",
|
||||
992 => x"0b87c094",
|
||||
993 => x"940c9ff4",
|
||||
994 => x"51f9923f",
|
||||
995 => x"8808b838",
|
||||
996 => x"9fdc51fc",
|
||||
997 => x"9b3f8808",
|
||||
998 => x"ae38a080",
|
||||
999 => x"0b880887",
|
||||
1000 => x"c098880c",
|
||||
1001 => x"55873dfc",
|
||||
1002 => x"05538480",
|
||||
1003 => x"527451fc",
|
||||
1004 => x"f63f8808",
|
||||
1005 => x"8d387554",
|
||||
1006 => x"73802e86",
|
||||
1007 => x"38731555",
|
||||
1008 => x"e439a080",
|
||||
1009 => x"54730480",
|
||||
1010 => x"54fb3900",
|
||||
1011 => x"00ffffff",
|
||||
1012 => x"ff00ffff",
|
||||
1013 => x"ffff00ff",
|
||||
1014 => x"ffffff00",
|
||||
1015 => x"424f4f54",
|
||||
1016 => x"54494e59",
|
||||
1017 => x"2e524f4d",
|
||||
1018 => x"00000000",
|
||||
1019 => x"01000000",
|
||||
others => x"00000000"
|
||||
);
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ architecture arch of DualPortBootBRAM is
|
||||
451 => x"38",
|
||||
452 => x"0b",
|
||||
453 => x"0b",
|
||||
454 => x"a8",
|
||||
454 => x"ec",
|
||||
455 => x"83",
|
||||
456 => x"fa",
|
||||
457 => x"7b",
|
||||
@@ -624,7 +624,7 @@ architecture arch of DualPortBootBRAM is
|
||||
553 => x"0c",
|
||||
554 => x"04",
|
||||
555 => x"0b",
|
||||
556 => x"ac",
|
||||
556 => x"f0",
|
||||
557 => x"88",
|
||||
558 => x"05",
|
||||
559 => x"80",
|
||||
@@ -672,7 +672,7 @@ architecture arch of DualPortBootBRAM is
|
||||
601 => x"86",
|
||||
602 => x"fa",
|
||||
603 => x"0b",
|
||||
604 => x"ac",
|
||||
604 => x"f0",
|
||||
605 => x"81",
|
||||
606 => x"ff",
|
||||
607 => x"54",
|
||||
@@ -945,7 +945,7 @@ architecture arch of DualPortBootBRAM is
|
||||
874 => x"0c",
|
||||
875 => x"04",
|
||||
876 => x"0b",
|
||||
877 => x"ac",
|
||||
877 => x"f0",
|
||||
878 => x"54",
|
||||
879 => x"80",
|
||||
880 => x"0b",
|
||||
@@ -1035,42 +1035,59 @@ architecture arch of DualPortBootBRAM is
|
||||
964 => x"88",
|
||||
965 => x"0d",
|
||||
966 => x"0d",
|
||||
967 => x"e4",
|
||||
968 => x"94",
|
||||
969 => x"90",
|
||||
970 => x"87",
|
||||
971 => x"0c",
|
||||
972 => x"0b",
|
||||
967 => x"8c",
|
||||
968 => x"84",
|
||||
969 => x"51",
|
||||
970 => x"88",
|
||||
971 => x"87",
|
||||
972 => x"08",
|
||||
973 => x"84",
|
||||
974 => x"83",
|
||||
975 => x"94",
|
||||
976 => x"b0",
|
||||
977 => x"3f",
|
||||
978 => x"38",
|
||||
979 => x"fc",
|
||||
980 => x"08",
|
||||
981 => x"80",
|
||||
974 => x"51",
|
||||
975 => x"73",
|
||||
976 => x"87",
|
||||
977 => x"0c",
|
||||
978 => x"9c",
|
||||
979 => x"84",
|
||||
980 => x"51",
|
||||
981 => x"88",
|
||||
982 => x"87",
|
||||
983 => x"0c",
|
||||
984 => x"fc",
|
||||
985 => x"80",
|
||||
986 => x"fd",
|
||||
987 => x"08",
|
||||
988 => x"54",
|
||||
989 => x"86",
|
||||
990 => x"55",
|
||||
991 => x"80",
|
||||
992 => x"80",
|
||||
993 => x"00",
|
||||
994 => x"ff",
|
||||
995 => x"ff",
|
||||
996 => x"ff",
|
||||
997 => x"00",
|
||||
998 => x"54",
|
||||
999 => x"59",
|
||||
1000 => x"4d",
|
||||
1001 => x"00",
|
||||
1002 => x"00",
|
||||
983 => x"08",
|
||||
984 => x"84",
|
||||
985 => x"51",
|
||||
986 => x"73",
|
||||
987 => x"87",
|
||||
988 => x"0c",
|
||||
989 => x"0b",
|
||||
990 => x"84",
|
||||
991 => x"83",
|
||||
992 => x"94",
|
||||
993 => x"f4",
|
||||
994 => x"3f",
|
||||
995 => x"38",
|
||||
996 => x"fc",
|
||||
997 => x"08",
|
||||
998 => x"80",
|
||||
999 => x"87",
|
||||
1000 => x"0c",
|
||||
1001 => x"fc",
|
||||
1002 => x"80",
|
||||
1003 => x"fc",
|
||||
1004 => x"08",
|
||||
1005 => x"54",
|
||||
1006 => x"86",
|
||||
1007 => x"55",
|
||||
1008 => x"80",
|
||||
1009 => x"80",
|
||||
1010 => x"00",
|
||||
1011 => x"ff",
|
||||
1012 => x"ff",
|
||||
1013 => x"ff",
|
||||
1014 => x"00",
|
||||
1015 => x"54",
|
||||
1016 => x"59",
|
||||
1017 => x"4d",
|
||||
1018 => x"00",
|
||||
1019 => x"00",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
@@ -1358,7 +1375,7 @@ architecture arch of DualPortBootBRAM is
|
||||
279 => x"51",
|
||||
280 => x"00",
|
||||
281 => x"00",
|
||||
282 => x"ac",
|
||||
282 => x"f0",
|
||||
283 => x"27",
|
||||
284 => x"71",
|
||||
285 => x"53",
|
||||
@@ -1536,7 +1553,7 @@ architecture arch of DualPortBootBRAM is
|
||||
457 => x"78",
|
||||
458 => x"58",
|
||||
459 => x"0b",
|
||||
460 => x"a8",
|
||||
460 => x"ec",
|
||||
461 => x"52",
|
||||
462 => x"70",
|
||||
463 => x"81",
|
||||
@@ -1658,7 +1675,7 @@ architecture arch of DualPortBootBRAM is
|
||||
579 => x"85",
|
||||
580 => x"fc",
|
||||
581 => x"0b",
|
||||
582 => x"ac",
|
||||
582 => x"f0",
|
||||
583 => x"80",
|
||||
584 => x"15",
|
||||
585 => x"81",
|
||||
@@ -2043,42 +2060,59 @@ architecture arch of DualPortBootBRAM is
|
||||
964 => x"76",
|
||||
965 => x"3d",
|
||||
966 => x"3d",
|
||||
967 => x"86",
|
||||
968 => x"c0",
|
||||
969 => x"9b",
|
||||
970 => x"0b",
|
||||
971 => x"9c",
|
||||
972 => x"83",
|
||||
973 => x"94",
|
||||
974 => x"80",
|
||||
975 => x"c0",
|
||||
976 => x"9f",
|
||||
977 => x"d6",
|
||||
978 => x"b8",
|
||||
979 => x"51",
|
||||
980 => x"88",
|
||||
981 => x"a0",
|
||||
982 => x"08",
|
||||
983 => x"88",
|
||||
984 => x"3d",
|
||||
985 => x"84",
|
||||
986 => x"51",
|
||||
987 => x"88",
|
||||
988 => x"75",
|
||||
989 => x"2e",
|
||||
990 => x"15",
|
||||
991 => x"a0",
|
||||
992 => x"04",
|
||||
993 => x"39",
|
||||
994 => x"ff",
|
||||
995 => x"ff",
|
||||
996 => x"00",
|
||||
997 => x"ff",
|
||||
998 => x"4f",
|
||||
999 => x"4e",
|
||||
1000 => x"4f",
|
||||
1001 => x"00",
|
||||
1002 => x"00",
|
||||
967 => x"94",
|
||||
968 => x"87",
|
||||
969 => x"73",
|
||||
970 => x"3f",
|
||||
971 => x"2b",
|
||||
972 => x"8c",
|
||||
973 => x"87",
|
||||
974 => x"74",
|
||||
975 => x"3f",
|
||||
976 => x"07",
|
||||
977 => x"8c",
|
||||
978 => x"94",
|
||||
979 => x"87",
|
||||
980 => x"73",
|
||||
981 => x"3f",
|
||||
982 => x"2b",
|
||||
983 => x"9c",
|
||||
984 => x"87",
|
||||
985 => x"74",
|
||||
986 => x"3f",
|
||||
987 => x"07",
|
||||
988 => x"9c",
|
||||
989 => x"83",
|
||||
990 => x"94",
|
||||
991 => x"80",
|
||||
992 => x"c0",
|
||||
993 => x"9f",
|
||||
994 => x"92",
|
||||
995 => x"b8",
|
||||
996 => x"51",
|
||||
997 => x"88",
|
||||
998 => x"a0",
|
||||
999 => x"08",
|
||||
1000 => x"88",
|
||||
1001 => x"3d",
|
||||
1002 => x"84",
|
||||
1003 => x"51",
|
||||
1004 => x"88",
|
||||
1005 => x"75",
|
||||
1006 => x"2e",
|
||||
1007 => x"15",
|
||||
1008 => x"a0",
|
||||
1009 => x"04",
|
||||
1010 => x"39",
|
||||
1011 => x"ff",
|
||||
1012 => x"ff",
|
||||
1013 => x"00",
|
||||
1014 => x"ff",
|
||||
1015 => x"4f",
|
||||
1016 => x"4e",
|
||||
1017 => x"4f",
|
||||
1018 => x"00",
|
||||
1019 => x"00",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
@@ -2367,7 +2401,7 @@ architecture arch of DualPortBootBRAM is
|
||||
280 => x"04",
|
||||
281 => x"04",
|
||||
282 => x"9f",
|
||||
283 => x"dc",
|
||||
283 => x"a0",
|
||||
284 => x"80",
|
||||
285 => x"05",
|
||||
286 => x"eb",
|
||||
@@ -2537,7 +2571,7 @@ architecture arch of DualPortBootBRAM is
|
||||
450 => x"08",
|
||||
451 => x"2e",
|
||||
452 => x"0b",
|
||||
453 => x"a8",
|
||||
453 => x"ec",
|
||||
454 => x"0b",
|
||||
455 => x"88",
|
||||
456 => x"0d",
|
||||
@@ -2607,7 +2641,7 @@ architecture arch of DualPortBootBRAM is
|
||||
520 => x"85",
|
||||
521 => x"f9",
|
||||
522 => x"0b",
|
||||
523 => x"ac",
|
||||
523 => x"f0",
|
||||
524 => x"81",
|
||||
525 => x"ed",
|
||||
526 => x"17",
|
||||
@@ -2957,7 +2991,7 @@ architecture arch of DualPortBootBRAM is
|
||||
870 => x"0c",
|
||||
871 => x"81",
|
||||
872 => x"0b",
|
||||
873 => x"ac",
|
||||
873 => x"f0",
|
||||
874 => x"75",
|
||||
875 => x"3d",
|
||||
876 => x"3d",
|
||||
@@ -2992,7 +3026,7 @@ architecture arch of DualPortBootBRAM is
|
||||
905 => x"0d",
|
||||
906 => x"0d",
|
||||
907 => x"0b",
|
||||
908 => x"ac",
|
||||
908 => x"f0",
|
||||
909 => x"5c",
|
||||
910 => x"0c",
|
||||
911 => x"80",
|
||||
@@ -3051,42 +3085,59 @@ architecture arch of DualPortBootBRAM is
|
||||
964 => x"57",
|
||||
965 => x"8c",
|
||||
966 => x"fb",
|
||||
967 => x"90",
|
||||
968 => x"87",
|
||||
969 => x"0c",
|
||||
970 => x"e4",
|
||||
971 => x"94",
|
||||
972 => x"80",
|
||||
973 => x"c0",
|
||||
974 => x"8c",
|
||||
975 => x"87",
|
||||
976 => x"0c",
|
||||
977 => x"f9",
|
||||
978 => x"08",
|
||||
979 => x"98",
|
||||
980 => x"3f",
|
||||
981 => x"38",
|
||||
982 => x"88",
|
||||
983 => x"98",
|
||||
984 => x"87",
|
||||
985 => x"53",
|
||||
986 => x"74",
|
||||
987 => x"3f",
|
||||
988 => x"38",
|
||||
967 => x"c0",
|
||||
968 => x"54",
|
||||
969 => x"52",
|
||||
970 => x"d7",
|
||||
971 => x"90",
|
||||
972 => x"94",
|
||||
973 => x"54",
|
||||
974 => x"52",
|
||||
975 => x"c3",
|
||||
976 => x"08",
|
||||
977 => x"94",
|
||||
978 => x"c0",
|
||||
979 => x"54",
|
||||
980 => x"52",
|
||||
981 => x"ab",
|
||||
982 => x"90",
|
||||
983 => x"94",
|
||||
984 => x"54",
|
||||
985 => x"52",
|
||||
986 => x"97",
|
||||
987 => x"08",
|
||||
988 => x"94",
|
||||
989 => x"80",
|
||||
990 => x"73",
|
||||
991 => x"39",
|
||||
992 => x"73",
|
||||
993 => x"fb",
|
||||
994 => x"ff",
|
||||
995 => x"00",
|
||||
996 => x"ff",
|
||||
997 => x"ff",
|
||||
998 => x"4f",
|
||||
999 => x"49",
|
||||
1000 => x"52",
|
||||
1001 => x"00",
|
||||
1002 => x"00",
|
||||
990 => x"c0",
|
||||
991 => x"8c",
|
||||
992 => x"87",
|
||||
993 => x"0c",
|
||||
994 => x"f9",
|
||||
995 => x"08",
|
||||
996 => x"dc",
|
||||
997 => x"3f",
|
||||
998 => x"38",
|
||||
999 => x"88",
|
||||
1000 => x"98",
|
||||
1001 => x"87",
|
||||
1002 => x"53",
|
||||
1003 => x"74",
|
||||
1004 => x"3f",
|
||||
1005 => x"38",
|
||||
1006 => x"80",
|
||||
1007 => x"73",
|
||||
1008 => x"39",
|
||||
1009 => x"73",
|
||||
1010 => x"fb",
|
||||
1011 => x"ff",
|
||||
1012 => x"00",
|
||||
1013 => x"ff",
|
||||
1014 => x"ff",
|
||||
1015 => x"4f",
|
||||
1016 => x"49",
|
||||
1017 => x"52",
|
||||
1018 => x"00",
|
||||
1019 => x"00",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
@@ -3254,7 +3305,7 @@ architecture arch of DualPortBootBRAM is
|
||||
159 => x"00",
|
||||
160 => x"71",
|
||||
161 => x"0b",
|
||||
162 => x"88",
|
||||
162 => x"cc",
|
||||
163 => x"10",
|
||||
164 => x"06",
|
||||
165 => x"88",
|
||||
@@ -3375,7 +3426,7 @@ architecture arch of DualPortBootBRAM is
|
||||
280 => x"80",
|
||||
281 => x"e2",
|
||||
282 => x"00",
|
||||
283 => x"9f",
|
||||
283 => x"a0",
|
||||
284 => x"38",
|
||||
285 => x"84",
|
||||
286 => x"88",
|
||||
@@ -3661,7 +3712,7 @@ architecture arch of DualPortBootBRAM is
|
||||
566 => x"04",
|
||||
567 => x"75",
|
||||
568 => x"0b",
|
||||
569 => x"ac",
|
||||
569 => x"f0",
|
||||
570 => x"51",
|
||||
571 => x"83",
|
||||
572 => x"06",
|
||||
@@ -3870,7 +3921,7 @@ architecture arch of DualPortBootBRAM is
|
||||
775 => x"04",
|
||||
776 => x"65",
|
||||
777 => x"0b",
|
||||
778 => x"ac",
|
||||
778 => x"f0",
|
||||
779 => x"3f",
|
||||
780 => x"06",
|
||||
781 => x"74",
|
||||
@@ -4059,42 +4110,59 @@ architecture arch of DualPortBootBRAM is
|
||||
964 => x"80",
|
||||
965 => x"0c",
|
||||
966 => x"04",
|
||||
967 => x"9b",
|
||||
968 => x"0b",
|
||||
969 => x"8c",
|
||||
970 => x"86",
|
||||
971 => x"c0",
|
||||
972 => x"8c",
|
||||
973 => x"87",
|
||||
974 => x"0c",
|
||||
975 => x"0b",
|
||||
976 => x"94",
|
||||
977 => x"51",
|
||||
978 => x"88",
|
||||
979 => x"9f",
|
||||
980 => x"df",
|
||||
981 => x"ae",
|
||||
982 => x"0b",
|
||||
967 => x"87",
|
||||
968 => x"08",
|
||||
969 => x"80",
|
||||
970 => x"ea",
|
||||
971 => x"08",
|
||||
972 => x"c0",
|
||||
973 => x"56",
|
||||
974 => x"80",
|
||||
975 => x"ea",
|
||||
976 => x"88",
|
||||
977 => x"c0",
|
||||
978 => x"87",
|
||||
979 => x"08",
|
||||
980 => x"80",
|
||||
981 => x"ea",
|
||||
982 => x"08",
|
||||
983 => x"c0",
|
||||
984 => x"55",
|
||||
985 => x"05",
|
||||
986 => x"52",
|
||||
987 => x"ba",
|
||||
988 => x"8d",
|
||||
989 => x"73",
|
||||
990 => x"38",
|
||||
991 => x"e4",
|
||||
992 => x"54",
|
||||
993 => x"54",
|
||||
994 => x"00",
|
||||
995 => x"ff",
|
||||
996 => x"ff",
|
||||
997 => x"ff",
|
||||
998 => x"42",
|
||||
999 => x"54",
|
||||
1000 => x"2e",
|
||||
1001 => x"00",
|
||||
1002 => x"01",
|
||||
984 => x"56",
|
||||
985 => x"80",
|
||||
986 => x"ea",
|
||||
987 => x"88",
|
||||
988 => x"c0",
|
||||
989 => x"8c",
|
||||
990 => x"87",
|
||||
991 => x"0c",
|
||||
992 => x"0b",
|
||||
993 => x"94",
|
||||
994 => x"51",
|
||||
995 => x"88",
|
||||
996 => x"9f",
|
||||
997 => x"9b",
|
||||
998 => x"ae",
|
||||
999 => x"0b",
|
||||
1000 => x"c0",
|
||||
1001 => x"55",
|
||||
1002 => x"05",
|
||||
1003 => x"52",
|
||||
1004 => x"f6",
|
||||
1005 => x"8d",
|
||||
1006 => x"73",
|
||||
1007 => x"38",
|
||||
1008 => x"e4",
|
||||
1009 => x"54",
|
||||
1010 => x"54",
|
||||
1011 => x"00",
|
||||
1012 => x"ff",
|
||||
1013 => x"ff",
|
||||
1014 => x"ff",
|
||||
1015 => x"42",
|
||||
1016 => x"54",
|
||||
1017 => x"2e",
|
||||
1018 => x"00",
|
||||
1019 => x"01",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
451 => x"38",
|
||||
452 => x"0b",
|
||||
453 => x"0b",
|
||||
454 => x"a8",
|
||||
454 => x"ec",
|
||||
455 => x"83",
|
||||
456 => x"fa",
|
||||
457 => x"7b",
|
||||
@@ -619,7 +619,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
553 => x"0c",
|
||||
554 => x"04",
|
||||
555 => x"0b",
|
||||
556 => x"ac",
|
||||
556 => x"f0",
|
||||
557 => x"88",
|
||||
558 => x"05",
|
||||
559 => x"80",
|
||||
@@ -667,7 +667,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
601 => x"86",
|
||||
602 => x"fa",
|
||||
603 => x"0b",
|
||||
604 => x"ac",
|
||||
604 => x"f0",
|
||||
605 => x"81",
|
||||
606 => x"ff",
|
||||
607 => x"54",
|
||||
@@ -940,7 +940,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
874 => x"0c",
|
||||
875 => x"04",
|
||||
876 => x"0b",
|
||||
877 => x"ac",
|
||||
877 => x"f0",
|
||||
878 => x"54",
|
||||
879 => x"80",
|
||||
880 => x"0b",
|
||||
@@ -1030,42 +1030,59 @@ architecture arch of SinglePortBootBRAM is
|
||||
964 => x"88",
|
||||
965 => x"0d",
|
||||
966 => x"0d",
|
||||
967 => x"e4",
|
||||
968 => x"94",
|
||||
969 => x"90",
|
||||
970 => x"87",
|
||||
971 => x"0c",
|
||||
972 => x"0b",
|
||||
967 => x"8c",
|
||||
968 => x"84",
|
||||
969 => x"51",
|
||||
970 => x"88",
|
||||
971 => x"87",
|
||||
972 => x"08",
|
||||
973 => x"84",
|
||||
974 => x"83",
|
||||
975 => x"94",
|
||||
976 => x"b0",
|
||||
977 => x"3f",
|
||||
978 => x"38",
|
||||
979 => x"fc",
|
||||
980 => x"08",
|
||||
981 => x"80",
|
||||
974 => x"51",
|
||||
975 => x"73",
|
||||
976 => x"87",
|
||||
977 => x"0c",
|
||||
978 => x"9c",
|
||||
979 => x"84",
|
||||
980 => x"51",
|
||||
981 => x"88",
|
||||
982 => x"87",
|
||||
983 => x"0c",
|
||||
984 => x"fc",
|
||||
985 => x"80",
|
||||
986 => x"fd",
|
||||
987 => x"08",
|
||||
988 => x"54",
|
||||
989 => x"86",
|
||||
990 => x"55",
|
||||
991 => x"80",
|
||||
992 => x"80",
|
||||
993 => x"00",
|
||||
994 => x"ff",
|
||||
995 => x"ff",
|
||||
996 => x"ff",
|
||||
997 => x"00",
|
||||
998 => x"54",
|
||||
999 => x"59",
|
||||
1000 => x"4d",
|
||||
1001 => x"00",
|
||||
1002 => x"00",
|
||||
983 => x"08",
|
||||
984 => x"84",
|
||||
985 => x"51",
|
||||
986 => x"73",
|
||||
987 => x"87",
|
||||
988 => x"0c",
|
||||
989 => x"0b",
|
||||
990 => x"84",
|
||||
991 => x"83",
|
||||
992 => x"94",
|
||||
993 => x"f4",
|
||||
994 => x"3f",
|
||||
995 => x"38",
|
||||
996 => x"fc",
|
||||
997 => x"08",
|
||||
998 => x"80",
|
||||
999 => x"87",
|
||||
1000 => x"0c",
|
||||
1001 => x"fc",
|
||||
1002 => x"80",
|
||||
1003 => x"fc",
|
||||
1004 => x"08",
|
||||
1005 => x"54",
|
||||
1006 => x"86",
|
||||
1007 => x"55",
|
||||
1008 => x"80",
|
||||
1009 => x"80",
|
||||
1010 => x"00",
|
||||
1011 => x"ff",
|
||||
1012 => x"ff",
|
||||
1013 => x"ff",
|
||||
1014 => x"00",
|
||||
1015 => x"54",
|
||||
1016 => x"59",
|
||||
1017 => x"4d",
|
||||
1018 => x"00",
|
||||
1019 => x"00",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
@@ -1353,7 +1370,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
279 => x"51",
|
||||
280 => x"00",
|
||||
281 => x"00",
|
||||
282 => x"ac",
|
||||
282 => x"f0",
|
||||
283 => x"27",
|
||||
284 => x"71",
|
||||
285 => x"53",
|
||||
@@ -1531,7 +1548,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
457 => x"78",
|
||||
458 => x"58",
|
||||
459 => x"0b",
|
||||
460 => x"a8",
|
||||
460 => x"ec",
|
||||
461 => x"52",
|
||||
462 => x"70",
|
||||
463 => x"81",
|
||||
@@ -1653,7 +1670,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
579 => x"85",
|
||||
580 => x"fc",
|
||||
581 => x"0b",
|
||||
582 => x"ac",
|
||||
582 => x"f0",
|
||||
583 => x"80",
|
||||
584 => x"15",
|
||||
585 => x"81",
|
||||
@@ -2038,42 +2055,59 @@ architecture arch of SinglePortBootBRAM is
|
||||
964 => x"76",
|
||||
965 => x"3d",
|
||||
966 => x"3d",
|
||||
967 => x"86",
|
||||
968 => x"c0",
|
||||
969 => x"9b",
|
||||
970 => x"0b",
|
||||
971 => x"9c",
|
||||
972 => x"83",
|
||||
973 => x"94",
|
||||
974 => x"80",
|
||||
975 => x"c0",
|
||||
976 => x"9f",
|
||||
977 => x"d6",
|
||||
978 => x"b8",
|
||||
979 => x"51",
|
||||
980 => x"88",
|
||||
981 => x"a0",
|
||||
982 => x"08",
|
||||
983 => x"88",
|
||||
984 => x"3d",
|
||||
985 => x"84",
|
||||
986 => x"51",
|
||||
987 => x"88",
|
||||
988 => x"75",
|
||||
989 => x"2e",
|
||||
990 => x"15",
|
||||
991 => x"a0",
|
||||
992 => x"04",
|
||||
993 => x"39",
|
||||
994 => x"ff",
|
||||
995 => x"ff",
|
||||
996 => x"00",
|
||||
997 => x"ff",
|
||||
998 => x"4f",
|
||||
999 => x"4e",
|
||||
1000 => x"4f",
|
||||
1001 => x"00",
|
||||
1002 => x"00",
|
||||
967 => x"94",
|
||||
968 => x"87",
|
||||
969 => x"73",
|
||||
970 => x"3f",
|
||||
971 => x"2b",
|
||||
972 => x"8c",
|
||||
973 => x"87",
|
||||
974 => x"74",
|
||||
975 => x"3f",
|
||||
976 => x"07",
|
||||
977 => x"8c",
|
||||
978 => x"94",
|
||||
979 => x"87",
|
||||
980 => x"73",
|
||||
981 => x"3f",
|
||||
982 => x"2b",
|
||||
983 => x"9c",
|
||||
984 => x"87",
|
||||
985 => x"74",
|
||||
986 => x"3f",
|
||||
987 => x"07",
|
||||
988 => x"9c",
|
||||
989 => x"83",
|
||||
990 => x"94",
|
||||
991 => x"80",
|
||||
992 => x"c0",
|
||||
993 => x"9f",
|
||||
994 => x"92",
|
||||
995 => x"b8",
|
||||
996 => x"51",
|
||||
997 => x"88",
|
||||
998 => x"a0",
|
||||
999 => x"08",
|
||||
1000 => x"88",
|
||||
1001 => x"3d",
|
||||
1002 => x"84",
|
||||
1003 => x"51",
|
||||
1004 => x"88",
|
||||
1005 => x"75",
|
||||
1006 => x"2e",
|
||||
1007 => x"15",
|
||||
1008 => x"a0",
|
||||
1009 => x"04",
|
||||
1010 => x"39",
|
||||
1011 => x"ff",
|
||||
1012 => x"ff",
|
||||
1013 => x"00",
|
||||
1014 => x"ff",
|
||||
1015 => x"4f",
|
||||
1016 => x"4e",
|
||||
1017 => x"4f",
|
||||
1018 => x"00",
|
||||
1019 => x"00",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
@@ -2362,7 +2396,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
280 => x"04",
|
||||
281 => x"04",
|
||||
282 => x"9f",
|
||||
283 => x"dc",
|
||||
283 => x"a0",
|
||||
284 => x"80",
|
||||
285 => x"05",
|
||||
286 => x"eb",
|
||||
@@ -2532,7 +2566,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
450 => x"08",
|
||||
451 => x"2e",
|
||||
452 => x"0b",
|
||||
453 => x"a8",
|
||||
453 => x"ec",
|
||||
454 => x"0b",
|
||||
455 => x"88",
|
||||
456 => x"0d",
|
||||
@@ -2602,7 +2636,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
520 => x"85",
|
||||
521 => x"f9",
|
||||
522 => x"0b",
|
||||
523 => x"ac",
|
||||
523 => x"f0",
|
||||
524 => x"81",
|
||||
525 => x"ed",
|
||||
526 => x"17",
|
||||
@@ -2952,7 +2986,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
870 => x"0c",
|
||||
871 => x"81",
|
||||
872 => x"0b",
|
||||
873 => x"ac",
|
||||
873 => x"f0",
|
||||
874 => x"75",
|
||||
875 => x"3d",
|
||||
876 => x"3d",
|
||||
@@ -2987,7 +3021,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
905 => x"0d",
|
||||
906 => x"0d",
|
||||
907 => x"0b",
|
||||
908 => x"ac",
|
||||
908 => x"f0",
|
||||
909 => x"5c",
|
||||
910 => x"0c",
|
||||
911 => x"80",
|
||||
@@ -3046,42 +3080,59 @@ architecture arch of SinglePortBootBRAM is
|
||||
964 => x"57",
|
||||
965 => x"8c",
|
||||
966 => x"fb",
|
||||
967 => x"90",
|
||||
968 => x"87",
|
||||
969 => x"0c",
|
||||
970 => x"e4",
|
||||
971 => x"94",
|
||||
972 => x"80",
|
||||
973 => x"c0",
|
||||
974 => x"8c",
|
||||
975 => x"87",
|
||||
976 => x"0c",
|
||||
977 => x"f9",
|
||||
978 => x"08",
|
||||
979 => x"98",
|
||||
980 => x"3f",
|
||||
981 => x"38",
|
||||
982 => x"88",
|
||||
983 => x"98",
|
||||
984 => x"87",
|
||||
985 => x"53",
|
||||
986 => x"74",
|
||||
987 => x"3f",
|
||||
988 => x"38",
|
||||
967 => x"c0",
|
||||
968 => x"54",
|
||||
969 => x"52",
|
||||
970 => x"d7",
|
||||
971 => x"90",
|
||||
972 => x"94",
|
||||
973 => x"54",
|
||||
974 => x"52",
|
||||
975 => x"c3",
|
||||
976 => x"08",
|
||||
977 => x"94",
|
||||
978 => x"c0",
|
||||
979 => x"54",
|
||||
980 => x"52",
|
||||
981 => x"ab",
|
||||
982 => x"90",
|
||||
983 => x"94",
|
||||
984 => x"54",
|
||||
985 => x"52",
|
||||
986 => x"97",
|
||||
987 => x"08",
|
||||
988 => x"94",
|
||||
989 => x"80",
|
||||
990 => x"73",
|
||||
991 => x"39",
|
||||
992 => x"73",
|
||||
993 => x"fb",
|
||||
994 => x"ff",
|
||||
995 => x"00",
|
||||
996 => x"ff",
|
||||
997 => x"ff",
|
||||
998 => x"4f",
|
||||
999 => x"49",
|
||||
1000 => x"52",
|
||||
1001 => x"00",
|
||||
1002 => x"00",
|
||||
990 => x"c0",
|
||||
991 => x"8c",
|
||||
992 => x"87",
|
||||
993 => x"0c",
|
||||
994 => x"f9",
|
||||
995 => x"08",
|
||||
996 => x"dc",
|
||||
997 => x"3f",
|
||||
998 => x"38",
|
||||
999 => x"88",
|
||||
1000 => x"98",
|
||||
1001 => x"87",
|
||||
1002 => x"53",
|
||||
1003 => x"74",
|
||||
1004 => x"3f",
|
||||
1005 => x"38",
|
||||
1006 => x"80",
|
||||
1007 => x"73",
|
||||
1008 => x"39",
|
||||
1009 => x"73",
|
||||
1010 => x"fb",
|
||||
1011 => x"ff",
|
||||
1012 => x"00",
|
||||
1013 => x"ff",
|
||||
1014 => x"ff",
|
||||
1015 => x"4f",
|
||||
1016 => x"49",
|
||||
1017 => x"52",
|
||||
1018 => x"00",
|
||||
1019 => x"00",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
@@ -3249,7 +3300,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
159 => x"00",
|
||||
160 => x"71",
|
||||
161 => x"0b",
|
||||
162 => x"88",
|
||||
162 => x"cc",
|
||||
163 => x"10",
|
||||
164 => x"06",
|
||||
165 => x"88",
|
||||
@@ -3370,7 +3421,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
280 => x"80",
|
||||
281 => x"e2",
|
||||
282 => x"00",
|
||||
283 => x"9f",
|
||||
283 => x"a0",
|
||||
284 => x"38",
|
||||
285 => x"84",
|
||||
286 => x"88",
|
||||
@@ -3656,7 +3707,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
566 => x"04",
|
||||
567 => x"75",
|
||||
568 => x"0b",
|
||||
569 => x"ac",
|
||||
569 => x"f0",
|
||||
570 => x"51",
|
||||
571 => x"83",
|
||||
572 => x"06",
|
||||
@@ -3865,7 +3916,7 @@ architecture arch of SinglePortBootBRAM is
|
||||
775 => x"04",
|
||||
776 => x"65",
|
||||
777 => x"0b",
|
||||
778 => x"ac",
|
||||
778 => x"f0",
|
||||
779 => x"3f",
|
||||
780 => x"06",
|
||||
781 => x"74",
|
||||
@@ -4054,42 +4105,59 @@ architecture arch of SinglePortBootBRAM is
|
||||
964 => x"80",
|
||||
965 => x"0c",
|
||||
966 => x"04",
|
||||
967 => x"9b",
|
||||
968 => x"0b",
|
||||
969 => x"8c",
|
||||
970 => x"86",
|
||||
971 => x"c0",
|
||||
972 => x"8c",
|
||||
973 => x"87",
|
||||
974 => x"0c",
|
||||
975 => x"0b",
|
||||
976 => x"94",
|
||||
977 => x"51",
|
||||
978 => x"88",
|
||||
979 => x"9f",
|
||||
980 => x"df",
|
||||
981 => x"ae",
|
||||
982 => x"0b",
|
||||
967 => x"87",
|
||||
968 => x"08",
|
||||
969 => x"80",
|
||||
970 => x"ea",
|
||||
971 => x"08",
|
||||
972 => x"c0",
|
||||
973 => x"56",
|
||||
974 => x"80",
|
||||
975 => x"ea",
|
||||
976 => x"88",
|
||||
977 => x"c0",
|
||||
978 => x"87",
|
||||
979 => x"08",
|
||||
980 => x"80",
|
||||
981 => x"ea",
|
||||
982 => x"08",
|
||||
983 => x"c0",
|
||||
984 => x"55",
|
||||
985 => x"05",
|
||||
986 => x"52",
|
||||
987 => x"ba",
|
||||
988 => x"8d",
|
||||
989 => x"73",
|
||||
990 => x"38",
|
||||
991 => x"e4",
|
||||
992 => x"54",
|
||||
993 => x"54",
|
||||
994 => x"00",
|
||||
995 => x"ff",
|
||||
996 => x"ff",
|
||||
997 => x"ff",
|
||||
998 => x"42",
|
||||
999 => x"54",
|
||||
1000 => x"2e",
|
||||
1001 => x"00",
|
||||
1002 => x"01",
|
||||
984 => x"56",
|
||||
985 => x"80",
|
||||
986 => x"ea",
|
||||
987 => x"88",
|
||||
988 => x"c0",
|
||||
989 => x"8c",
|
||||
990 => x"87",
|
||||
991 => x"0c",
|
||||
992 => x"0b",
|
||||
993 => x"94",
|
||||
994 => x"51",
|
||||
995 => x"88",
|
||||
996 => x"9f",
|
||||
997 => x"9b",
|
||||
998 => x"ae",
|
||||
999 => x"0b",
|
||||
1000 => x"c0",
|
||||
1001 => x"55",
|
||||
1002 => x"05",
|
||||
1003 => x"52",
|
||||
1004 => x"f6",
|
||||
1005 => x"8d",
|
||||
1006 => x"73",
|
||||
1007 => x"38",
|
||||
1008 => x"e4",
|
||||
1009 => x"54",
|
||||
1010 => x"54",
|
||||
1011 => x"00",
|
||||
1012 => x"ff",
|
||||
1013 => x"ff",
|
||||
1014 => x"ff",
|
||||
1015 => x"42",
|
||||
1016 => x"54",
|
||||
1017 => x"2e",
|
||||
1018 => x"00",
|
||||
1019 => x"01",
|
||||
others => X"00"
|
||||
);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -90,24 +90,25 @@ architecture arch of SinglePortBRAM is
|
||||
begin
|
||||
|
||||
RAM0_DATA <= memAWrite(7 downto 0);
|
||||
RAM0_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "00") or (memAWriteHalfWord = '1' and memAAddr(1) = '0'))
|
||||
else '0';
|
||||
RAM1_DATA <= memAWrite(15 downto 8) when (memAWriteByte = '0' and memAWriteHalfWord = '0') or memAWriteHalfWord = '1'
|
||||
else
|
||||
memAWrite(7 downto 0);
|
||||
RAM1_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "01") or (memAWriteHalfWord = '1' and memAAddr(1) = '0'))
|
||||
else '0';
|
||||
RAM2_DATA <= memAWrite(23 downto 16) when (memAWriteByte = '0' and memAWriteHalfWord = '0')
|
||||
else
|
||||
memAWrite(7 downto 0);
|
||||
RAM2_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "10") or (memAWriteHalfWord = '1' and memAAddr(1) = '1'))
|
||||
else '0';
|
||||
RAM3_DATA <= memAWrite(31 downto 24) when (memAWriteByte = '0' and memAWriteHalfWord = '0')
|
||||
else
|
||||
memAWrite(15 downto 8) when memAWriteHalfWord = '1'
|
||||
else
|
||||
memAWrite(7 downto 0);
|
||||
RAM3_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "11") or (memAWriteHalfWord = '1' and memAAddr(1) = '1'))
|
||||
|
||||
RAM0_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "11") or (memAWriteHalfWord = '1' and memAAddr(1) = '1'))
|
||||
else '0';
|
||||
RAM1_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "10") or (memAWriteHalfWord = '1' and memAAddr(1) = '1'))
|
||||
else '0';
|
||||
RAM2_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "01") or (memAWriteHalfWord = '1' and memAAddr(1) = '0'))
|
||||
else '0';
|
||||
RAM3_WREN <= '1' when memAWriteEnable = '1' and ((memAWriteByte = '0' and memAWriteHalfWord = '0') or (memAWriteByte = '1' and memAAddr(1 downto 0) = "00") or (memAWriteHalfWord = '1' and memAAddr(1) = '0'))
|
||||
else '0';
|
||||
|
||||
-- RAM Byte 0 - Port A - bits 7 to 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
64
software/apps/Makefile
Executable file
64
software/apps/Makefile
Executable file
@@ -0,0 +1,64 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
FS_SUBDIRS := falloc fattr fcat fcd fclose fconcat fcp fdel fdir fdrive fdump finspect flabel fmkdir
|
||||
FS_SUBDIRS += fmkfs fopen fread frename fsave fseek fshowdir fstat ftime ftrunc fwrite fxtract
|
||||
DISK_SUBDIRS := ddump dstat
|
||||
BUFFER_SUBDIRS:= bdump bedit bread bwrite bfill blen
|
||||
MEM_SUBDIRS := mclear mcopy mdiff mdump meb meh mew mperf msrch mtest
|
||||
HW_SUBDIRS := hr ht
|
||||
TST_SUBDIRS := dhry coremark
|
||||
MISC_SUBDIRS := help time test
|
||||
SUBDIRS := $(FS_SUBDIRS) $(DISK_SUBDIRS) $(BUFFER_SUBDIRS) $(MEM_SUBDIRS) $(HW_SUBDIRS) $(TST_SUBDIRS) $(MISC_SUBDIRS)
|
||||
BASEDIR = ../..
|
||||
TARGETS := all clean install
|
||||
|
||||
# Our target.
|
||||
$(TARGETS): $(SUBDIRS)
|
||||
#
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
||||
install:
|
||||
.PHONY: $(TARGETS) $(SUBDIRS)
|
||||
248
software/apps/Makefile.inc
Executable file
248
software/apps/Makefile.inc
Executable file
@@ -0,0 +1,248 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile.inc
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile common rules - Build an App for the ZPU Test Application (zputa)
|
||||
## This include file adds most of the rules to build an app which is stored on an SD card
|
||||
## and called by the ZPUTA test application. The app generally is for testing some component
|
||||
## where the code is not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile.inc created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
# APP_NAME, APP_DIR and BASEDIR defined in calling Makefile
|
||||
|
||||
# Addresses where the ZPUTA base program loads and where apps load and execute.
|
||||
# With IOCP
|
||||
#ZPUTA_BASEADDR = 0x02000
|
||||
#ZPUTA_APPADDR = 0x50000
|
||||
# Standalone
|
||||
ifeq ($(ZPUTA_BASEADDR),)
|
||||
ZPUTA_BASEADDR = 0x001000
|
||||
endif
|
||||
ifeq ($(ZPUTA_APPADDR),)
|
||||
ZPUTA_APPADDR = 0x00C000
|
||||
endif
|
||||
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/sysbus/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone_${ZPUTA_BASEADDR}_${ZPUTA_APPADDR}.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ += $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
# To disable use of a given instruction, prefix it with no-
|
||||
ZPUOPTS = -mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
ifeq ($(CPU), $(filter $(CPU),SMALL MEDIUM FLEX))
|
||||
ZPUOPTS += -mno-mult \
|
||||
-mno-div \
|
||||
-mno-mod \
|
||||
-mno-neg
|
||||
endif
|
||||
ifeq ($(CPU), $(filter $(CPU),EVO))
|
||||
ZPUOPTS += -mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg
|
||||
endif
|
||||
|
||||
#CFLAGS += -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS += -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O3 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU -DZPUTA_BASEADDR=$(ZPUTA_BASEADDR) -DZPUTA_APPADDR=$(ZPUTA_APPADDR)
|
||||
#CFLAGS += -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os -Wl,--defsym=ZPUTA_BASEADDR=$(ZPUTA_BASEADDR) -Wl,--defsym=ZPUTA_APPADDR=$(ZPUTA_APPADDR)
|
||||
#
|
||||
# Assembler flags.
|
||||
ifeq ($(ZPUTA_BASEADDR),0x000000)
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x400 --defsym ZPUTA_APPADDR=$(ZPUTA_APPADDR)
|
||||
else
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=$(ZPUTA_BASEADDR) --defsym ZPUTA_APPADDR=$(ZPUTA_APPADDR)
|
||||
endif
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(DHRY_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(CORE_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $(FLAGS_STR) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
42
software/apps/bdump/Makefile
Executable file
42
software/apps/bdump/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bdump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
84
software/apps/bdump/bdump.c
Executable file
84
software/apps/bdump/bdump.c
Executable file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bdump.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "bdump.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "BDUMP"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long offset;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &offset))
|
||||
{
|
||||
xprintf("Illegal <offset> value.\n");
|
||||
} else
|
||||
{
|
||||
memoryDump((uint32_t)&G->Buff[offset], 0x200, 16, offset, 32);
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/bdump/bdump.h
Executable file
108
software/apps/bdump/bdump.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bdump.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BDUMP_H
|
||||
#define BDUMP_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 1
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // BDUMP_H
|
||||
42
software/apps/bedit/Makefile
Executable file
42
software/apps/bedit/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bedit
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
106
software/apps/bedit/bedit.c
Executable file
106
software/apps/bedit/bedit.c
Executable file
@@ -0,0 +1,106 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bedit.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "bedit.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "BEDIT"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char line[120];
|
||||
long addr;
|
||||
long data;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &addr))
|
||||
{
|
||||
xprintf("Illegal <addr> value.\n");
|
||||
} else
|
||||
{
|
||||
if (xatoi(&ptr, &data))
|
||||
{
|
||||
do {
|
||||
G->Buff[addr++] = (BYTE)data;
|
||||
} while (xatoi(&ptr, &data));
|
||||
} else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
xprintf("%04X %02X-", (WORD)addr, G->Buff[addr]);
|
||||
xgets(line, sizeof line);
|
||||
ptr = line;
|
||||
if (*ptr == '.') break;
|
||||
if (*ptr < ' ') { addr++; continue; }
|
||||
if (xatoi(&ptr, &data)) {
|
||||
G->Buff[addr++] = (BYTE)data;
|
||||
} else {
|
||||
xputs("???\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/bedit/bedit.h
Executable file
108
software/apps/bedit/bedit.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bedit.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BEDIT_H
|
||||
#define BEDIT_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 1
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // BEDIT_H
|
||||
42
software/apps/bfill/Makefile
Executable file
42
software/apps/bfill/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bfill
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
84
software/apps/bfill/bfill.c
Executable file
84
software/apps/bfill/bfill.c
Executable file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bfill.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "bfill.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "BFILL"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long value;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &value))
|
||||
{
|
||||
xprintf("Illegal <n> value.\n");
|
||||
} else
|
||||
{
|
||||
memset(G->Buff, (BYTE)value, sizeof G->Buff);
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/bfill/bfill.h
Executable file
108
software/apps/bfill/bfill.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bfill.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BFILL_H
|
||||
#define BFILL_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 1
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // BFILL_H
|
||||
42
software/apps/blen/Makefile
Executable file
42
software/apps/blen/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = blen
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
85
software/apps/blen/blen.c
Executable file
85
software/apps/blen/blen.c
Executable file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: blen.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "blen.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "BLEN"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long len;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
if(!xatoi(&ptr, &len))
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = fileSetBlockLen(len);
|
||||
if(fr) { printFSCode(fr); } else { xprintf("R/W length = %u\n", len); retCode = 0; }
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
109
software/apps/blen/blen.h
Executable file
109
software/apps/blen/blen.h
Executable file
@@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: blen.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BLEN_H
|
||||
#define BLEN_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 1
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // BLEN_H
|
||||
42
software/apps/bread/Makefile
Executable file
42
software/apps/bread/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bread
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
90
software/apps/bread/bread.c
Executable file
90
software/apps/bread/bread.c
Executable file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bread.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "bread.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "BREAD"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long drive;
|
||||
long sector;
|
||||
long count;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
} else if(!xatoi(&ptr, §or))
|
||||
{
|
||||
xprintf("Illegal <sector> value.\n");
|
||||
} else
|
||||
{
|
||||
if(!xatoi(&ptr, &count)) count = 1;
|
||||
xprintf("rc=%u\n", disk_read((BYTE)drive, G->Buff, sector, count));
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
109
software/apps/bread/bread.h
Executable file
109
software/apps/bread/bread.h
Executable file
@@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bread.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BREAD_H
|
||||
#define BREAD_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 1
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // BREAD_H
|
||||
42
software/apps/bwrite/Makefile
Executable file
42
software/apps/bwrite/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = bwrite
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
90
software/apps/bwrite/bwrite.c
Executable file
90
software/apps/bwrite/bwrite.c
Executable file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bwrite.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "bwrite.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "BWRITE"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long drive;
|
||||
long sector;
|
||||
long count;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
} else if(!xatoi(&ptr, §or))
|
||||
{
|
||||
xprintf("Illegal <sector> value.\n");
|
||||
} else
|
||||
{
|
||||
if(!xatoi(&ptr, &count)) count = 1;
|
||||
xprintf("rc=%u\n", disk_write((BYTE)drive, G->Buff, sector, count));
|
||||
retCode = 0;
|
||||
}
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
109
software/apps/bwrite/bwrite.h
Executable file
109
software/apps/bwrite/bwrite.h
Executable file
@@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: bwrite.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BWRITE_H
|
||||
#define BWRITE_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 1
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // BWRITE_H
|
||||
60
software/apps/coremark/Makefile
Executable file
60
software/apps/coremark/Makefile
Executable file
@@ -0,0 +1,60 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = coremark
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
|
||||
# Coremark/Dhrystone specific settings.
|
||||
DHRY_DIR = $(SWDIR)/common/Dhrystone
|
||||
CORE_DIR = $(SWDIR)/common/CoreMark
|
||||
DHRY_SRC = $(DHRY_DIR)/dhry_1.c $(DHRY_DIR)/dhry_2.c
|
||||
CORE_SRC = $(CORE_DIR)/core_list_join.c $(CORE_DIR)/core_main_embedded.c $(CORE_DIR)/core_matrix.c $(CORE_DIR)/core_state.c $(CORE_DIR)/core_util.c $(CORE_DIR)/ee_printf.c $(CORE_DIR)/core_portme.c
|
||||
DHRY_OBJ = $(patsubst $(DHRY_DIR)/%.c,$(BUILD_DIR)/%.o,$(DHRY_SRC))
|
||||
CORE_OBJ = $(patsubst $(CORE_DIR)/%.c,$(BUILD_DIR)/%.o,$(CORE_SRC))
|
||||
|
||||
MAIN_OBJ = $(CORE_OBJ)
|
||||
|
||||
CFLAGS += -I$(DHRY_DIR) -I$(CORE_DIR)
|
||||
# Enable CoreMark Test
|
||||
OFLAGS += -DCOREMARK_TEST
|
||||
# Enable Dhrystone Test
|
||||
#OFLAGS += -DDHRYSTONE_TEST
|
||||
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
237
software/apps/coremark/Makefile.old
Executable file
237
software/apps/coremark/Makefile.old
Executable file
@@ -0,0 +1,237 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = coremark
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
DHRY_DIR = $(SWDIR)/common/Dhrystone
|
||||
CORE_DIR = $(SWDIR)/common/CoreMark
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
DHRY_SRC = $(DHRY_DIR)/dhry_1.c $(DHRY_DIR)/dhry_2.c
|
||||
CORE_SRC = $(CORE_DIR)/core_list_join.c $(CORE_DIR)/core_main_embedded.c $(CORE_DIR)/core_matrix.c $(CORE_DIR)/core_state.c $(CORE_DIR)/core_util.c $(CORE_DIR)/ee_printf.c $(CORE_DIR)/core_portme.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
DHRY_OBJ = $(patsubst $(DHRY_DIR)/%.c,$(BUILD_DIR)/%.o,$(DHRY_SRC))
|
||||
CORE_OBJ = $(patsubst $(CORE_DIR)/%.c,$(BUILD_DIR)/%.o,$(CORE_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(CORE_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(DHRY_DIR) -I$(CORE_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O3 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Enable CoreMark Test
|
||||
OFLAGS += -DCOREMARK_TEST
|
||||
# Enable Dhrystone Test
|
||||
#OFLAGS += -DDHRYSTONE_TEST
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(DHRY_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(CORE_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $(FLAGS_STR) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
81
software/apps/coremark/coremark.c
Executable file
81
software/apps/coremark/coremark.c
Executable file
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: coremark.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "coremk.h"
|
||||
#include "coremark.h"
|
||||
|
||||
// Utility functions.
|
||||
//#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "COREMARK"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
// Run a CoreMark test to evaluate CPU speed.
|
||||
xputs("Running CoreMark test, please wait ...\n\n");
|
||||
CoreMarkTest();
|
||||
retCode = 0;
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
110
software/apps/coremark/coremk.h
Executable file
110
software/apps/coremark/coremk.h
Executable file
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: coremark.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef COREMARK_H
|
||||
#define COREMARK_H
|
||||
|
||||
// Constants.
|
||||
#define DEBUG 1
|
||||
#define CORE_DEBUG 1
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 1
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // COREMARK_H
|
||||
42
software/apps/ddump/Makefile
Executable file
42
software/apps/ddump/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = ddump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
93
software/apps/ddump/ddump.c
Executable file
93
software/apps/ddump/ddump.c
Executable file
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: ddump.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "ddump.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "DDUMP"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long drive;
|
||||
long sector;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
if(!xatoi(&ptr, &drive))
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, §or)) sector = G->Sector;
|
||||
fr = disk_read((BYTE)drive, G->Buff, sector, 1);
|
||||
if(!fr)
|
||||
{
|
||||
G->Sector = sector + 1;
|
||||
xprintf("Sector:%lu\n", sector);
|
||||
memoryDump((uint32_t)G->Buff, 0x200, 16, 0, 32);
|
||||
}
|
||||
}
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/ddump/ddump.h
Executable file
108
software/apps/ddump/ddump.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: ddump.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DDUMP_H
|
||||
#define DDUMP_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 1
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // DDUMP_H
|
||||
60
software/apps/dhry/Makefile
Executable file
60
software/apps/dhry/Makefile
Executable file
@@ -0,0 +1,60 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = dhry
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
|
||||
# Coremark/Dhrystone specific settings.
|
||||
DHRY_DIR = $(SWDIR)/common/Dhrystone
|
||||
CORE_DIR = $(SWDIR)/common/CoreMark
|
||||
DHRY_SRC = $(DHRY_DIR)/dhry_1.c $(DHRY_DIR)/dhry_2.c
|
||||
CORE_SRC = $(CORE_DIR)/core_list_join.c $(CORE_DIR)/core_main_embedded.c $(CORE_DIR)/core_matrix.c $(CORE_DIR)/core_state.c $(CORE_DIR)/core_util.c $(CORE_DIR)/ee_printf.c $(CORE_DIR)/core_portme.c
|
||||
DHRY_OBJ = $(patsubst $(DHRY_DIR)/%.c,$(BUILD_DIR)/%.o,$(DHRY_SRC))
|
||||
CORE_OBJ = $(patsubst $(CORE_DIR)/%.c,$(BUILD_DIR)/%.o,$(CORE_SRC))
|
||||
|
||||
MAIN_OBJ = $(DHRY_OBJ)
|
||||
|
||||
CFLAGS += -I$(DHRY_DIR) -I$(CORE_DIR)
|
||||
# Enable CoreMark Test
|
||||
OFLAGS += -DCOREMARK_TEST
|
||||
# Enable Dhrystone Test
|
||||
#OFLAGS += -DDHRYSTONE_TEST
|
||||
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
237
software/apps/dhry/Makefile.old
Executable file
237
software/apps/dhry/Makefile.old
Executable file
@@ -0,0 +1,237 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = dhry
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
DHRY_DIR = $(SWDIR)/common/Dhrystone
|
||||
CORE_DIR = $(SWDIR)/common/CoreMark
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
DHRY_SRC = $(DHRY_DIR)/dhry_1.c $(DHRY_DIR)/dhry_2.c
|
||||
CORE_SRC = $(CORE_DIR)/core_list_join.c $(CORE_DIR)/core_main_embedded.c $(CORE_DIR)/core_matrix.c $(CORE_DIR)/core_state.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
DHRY_OBJ = $(patsubst $(DHRY_DIR)/%.c,$(BUILD_DIR)/%.o,$(DHRY_SRC))
|
||||
CORE_OBJ = $(patsubst $(CORE_DIR)/%.c,$(BUILD_DIR)/%.o,$(CORE_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(DHRY_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(DHRY_DIR) -I$(CORE_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O3 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Enable CoreMark Test
|
||||
#OFLAGS += -DCOREMARK_TEST
|
||||
# Enable Dhrystone Test
|
||||
OFLAGS += -DDHRYSTONE_TEST
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/dhry.zpu
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(DHRY_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(CORE_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $(FLAGS_STR) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
80
software/apps/dhry/dhry.c
Executable file
80
software/apps/dhry/dhry.c
Executable file
@@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dhrystone.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "dhry.h"
|
||||
|
||||
// Utility functions.
|
||||
//#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "DHRYSTONE"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
// Run a Dhrystone test to evaluate CPU speed.
|
||||
xputs("Running Dhrystone test, please wait ...\n\n");
|
||||
main_dhry();
|
||||
retCode = 0;
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
109
software/apps/dhry/dhry.h
Executable file
109
software/apps/dhry/dhry.h
Executable file
@@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dhry.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DHRY_H
|
||||
#define DHRY_H
|
||||
#include "dhry.h"
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 1
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // DHRY_H
|
||||
42
software/apps/dstat/Makefile
Executable file
42
software/apps/dstat/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = dstat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
121
software/apps/dstat/dstat.c
Executable file
121
software/apps/dstat/dstat.c
Executable file
@@ -0,0 +1,121 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dstat.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "dstat.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "DSTAT"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char line[120];
|
||||
long drive;
|
||||
long sector;
|
||||
uint8_t cardType;
|
||||
|
||||
if (xatoi(&ptr, &drive))
|
||||
{
|
||||
if (disk_ioctl((BYTE)drive, GET_SECTOR_COUNT, §or) == RES_OK)
|
||||
{
|
||||
xprintf("Drive size: %lu sectors\n", sector);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, GET_BLOCK_SIZE, §or) == RES_OK)
|
||||
{
|
||||
xprintf("Erase block: %lu sectors\n", sector);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_TYPE, &cardType) == RES_OK)
|
||||
{
|
||||
xprintf("Card type: %u\n", cardType);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_CSD, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("CSD:\n"); memoryDump((uint32_t)G->Buff, 16, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_CID, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("CID:\n"); memoryDump((uint32_t)G->Buff, 16, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_OCR, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("OCR:\n"); memoryDump((uint32_t)G->Buff, 4, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, MMC_GET_SDSTAT, G->Buff) == RES_OK)
|
||||
{
|
||||
xputs("SD Status:\n");
|
||||
memoryDump((uint32_t)G->Buff, 64, 16, 0, 32);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, ATA_GET_MODEL, line) == RES_OK)
|
||||
{
|
||||
line[40] = '\0'; xprintf("Model: %s\n", line);
|
||||
}
|
||||
if (disk_ioctl((BYTE)drive, ATA_GET_SN, line) == RES_OK)
|
||||
{
|
||||
line[20] = '\0'; xprintf("S/N: %s\n", line);
|
||||
}
|
||||
} else
|
||||
{
|
||||
xprintf("Illegal <#pd> value.\n");
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
108
software/apps/dstat/dstat.h
Executable file
108
software/apps/dstat/dstat.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: dstat.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DSTAT_H
|
||||
#define DSTAT_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 1
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // DSTAT_H
|
||||
42
software/apps/falloc/Makefile
Executable file
42
software/apps/falloc/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = falloc
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/falloc/Makefile.old
Executable file
221
software/apps/falloc/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = falloc
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
93
software/apps/falloc/falloc.c
Executable file
93
software/apps/falloc/falloc.c
Executable file
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: falloc.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "falloc.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FALLOC"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
long size;
|
||||
long option;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot allocate block.\n");
|
||||
} else
|
||||
{
|
||||
if (!xatoi(&ptr, &size) || !xatoi(&ptr, &option))
|
||||
{
|
||||
xputs("Illegal <size> or <option> value.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_expand(&G->File[0], (DWORD)size, (BYTE)option);
|
||||
}
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/falloc/falloc.h
Executable file
108
software/apps/falloc/falloc.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: falloc.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FALLOC_H
|
||||
#define FALLOC_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 1
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FALLOC_H
|
||||
42
software/apps/fattr/Makefile
Executable file
42
software/apps/fattr/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fattr
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fattr/Makefile.old
Executable file
221
software/apps/fattr/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fattr
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
89
software/apps/fattr/fattr.c
Executable file
89
software/apps/fattr/fattr.c
Executable file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fattr.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fattr.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FATTR"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *fileName;
|
||||
long attr;
|
||||
long mask;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
if (!xatoi(&ptr, &attr) || !xatoi(&ptr, &mask))
|
||||
{
|
||||
xprintf("Illegal <attr> <mask> value.\n");
|
||||
} else
|
||||
{
|
||||
fileName = getStrParam(&ptr);
|
||||
fr = f_chmod(ptr, attr, mask);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fattr/fattr.h
Executable file
108
software/apps/fattr/fattr.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fattr.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FATTR_H
|
||||
#define FATTR_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 1
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FATTR_H
|
||||
42
software/apps/fcat/Makefile
Executable file
42
software/apps/fcat/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
222
software/apps/fcat/Makefile.old
Executable file
222
software/apps/fcat/Makefile.old
Executable file
@@ -0,0 +1,222 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
85
software/apps/fcat/fcat.c
Executable file
85
software/apps/fcat/fcat.c
Executable file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcat.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fcat.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FCAT"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *fileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
fileName = getStrParam(&ptr);
|
||||
if(*fileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <file> value.\n");
|
||||
} else
|
||||
fr = fileCat(fileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fcat/fcat.h
Executable file
108
software/apps/fcat/fcat.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcat.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCAT_H
|
||||
#define FCAT_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 1
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FSAVE_H
|
||||
42
software/apps/fcd/Makefile
Executable file
42
software/apps/fcd/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fcd
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fcd/Makefile.old
Executable file
221
software/apps/fcd/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fcd
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
85
software/apps/fcd/fcd.c
Executable file
85
software/apps/fcd/fcd.c
Executable file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcd.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fcd.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FCD"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dirName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
dirName = getStrParam(&ptr);
|
||||
if(*dirName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <path> value.\n");
|
||||
} else
|
||||
fr = f_chdir(dirName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fcd/fcd.h
Executable file
108
software/apps/fcd/fcd.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcd.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCD_H
|
||||
#define FCD_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 1
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FCD_H
|
||||
42
software/apps/fclose/Makefile
Executable file
42
software/apps/fclose/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fclose
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fclose/Makefile.old
Executable file
221
software/apps/fclose/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fclose
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
86
software/apps/fclose/fclose.c
Executable file
86
software/apps/fclose/fclose.c
Executable file
@@ -0,0 +1,86 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fclose.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fclose.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FCLOSE"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, cannot close.\n");
|
||||
} else
|
||||
{
|
||||
fr = f_close(&G->File[0]);
|
||||
if( fr == FR_OK ) { G->fileInUse = 0; }
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fclose/fclose.h
Executable file
108
software/apps/fclose/fclose.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fclose.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCLOSE_H
|
||||
#define FCLOSE_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 1
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FCLOSE_H
|
||||
42
software/apps/fconcat/Makefile
Executable file
42
software/apps/fconcat/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fconcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fconcat/Makefile.old
Executable file
221
software/apps/fconcat/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fconcat
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
89
software/apps/fconcat/fconcat.c
Executable file
89
software/apps/fconcat/fconcat.c
Executable file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fconcat.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fconcat.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FCONCAT"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *src1FileName;
|
||||
char *src2FileName;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
src1FileName= getStrParam(&ptr);
|
||||
src2FileName= getStrParam(&ptr);
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*src1FileName == 0x00 || *src2FileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src1>, <src2> or <dst> value.\n");
|
||||
} else
|
||||
fr = fileConcatenate(src1FileName, src2FileName, dstFileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fconcat/fconcat.h
Executable file
108
software/apps/fconcat/fconcat.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fconcat.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCONCAT_H
|
||||
#define FCONCAT_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 1
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FCONCAT_H
|
||||
42
software/apps/fcp/Makefile
Executable file
42
software/apps/fcp/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fcp
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fcp/Makefile.old
Executable file
221
software/apps/fcp/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fcp
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
87
software/apps/fcp/fcp.c
Executable file
87
software/apps/fcp/fcp.c
Executable file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcp.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fcp.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FCP"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *srcFileName;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
srcFileName = getStrParam(&ptr);
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*srcFileName == 0x00 || *dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <src> or <dst> value.\n");
|
||||
} else
|
||||
fr = fileCopy(srcFileName, dstFileName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fcp/fcp.h
Executable file
108
software/apps/fcp/fcp.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fcp.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FCP_H
|
||||
#define FCP_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 1
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FCP_H
|
||||
42
software/apps/fdel/Makefile
Executable file
42
software/apps/fdel/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdel
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fdel/Makefile.old
Executable file
221
software/apps/fdel/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fdel
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
89
software/apps/fdel/fdel.c
Executable file
89
software/apps/fdel/fdel.c
Executable file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdel.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fdel.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FDEL"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dstFileName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
dstFileName = getStrParam(&ptr);
|
||||
if(*dstFileName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <file> value.\n");
|
||||
} else
|
||||
{
|
||||
xprintf("GOING TO UNLINK(%s)\n", dstFileName);
|
||||
fr = f_unlink(dstFileName);
|
||||
xprintf("UNLINKED(%s)\n", dstFileName);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
xprintf("DONE\n");
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fdel/fdel.h
Executable file
108
software/apps/fdel/fdel.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdel.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FSAVE_H
|
||||
#define FSAVE_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 1
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FDEL_H
|
||||
42
software/apps/fdir/Makefile
Executable file
42
software/apps/fdir/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdir
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fdir/Makefile.old
Executable file
221
software/apps/fdir/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fdir
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
81
software/apps/fdir/fdir.c
Executable file
81
software/apps/fdir/fdir.c
Executable file
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdir.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fdir.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FDIR"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *pathName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
pathName = getStrParam(&ptr);
|
||||
fr = printDirectoryListing(pathName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fdir/fdir.h
Executable file
108
software/apps/fdir/fdir.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdir.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FDIR_H
|
||||
#define FDIR_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 1
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FDIR_H
|
||||
42
software/apps/fdrive/Makefile
Executable file
42
software/apps/fdrive/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdrive
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fdrive/Makefile.old
Executable file
221
software/apps/fdrive/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fdrive
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
81
software/apps/fdrive/fdrive.c
Executable file
81
software/apps/fdrive/fdrive.c
Executable file
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdrive.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fdrive.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FDRIVE"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *driveNo;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
driveNo = getStrParam(&ptr);
|
||||
fr = f_chdrive(driveNo);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fdrive/fdrive.h
Executable file
108
software/apps/fdrive/fdrive.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdrive.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FDRIVE_H
|
||||
#define FDRIVE_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 1
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FDRIVE_H
|
||||
42
software/apps/fdump/Makefile
Executable file
42
software/apps/fdump/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
42
software/apps/fdump/Makefile.old
Executable file
42
software/apps/fdump/Makefile.old
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fdump
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
83
software/apps/fdump/fdump.c
Executable file
83
software/apps/fdump/fdump.c
Executable file
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdump.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fdump.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FDUMP"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *srcFileName;
|
||||
uint32_t width;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
srcFileName = getStrParam(&ptr);
|
||||
if((width = getUintParam(&ptr)) == 0) { width = 8; }
|
||||
fr = fileDump(srcFileName, width);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fdump/fdump.h
Executable file
108
software/apps/fdump/fdump.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fdump.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FDUMP_H
|
||||
#define FDUMP_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 1
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FDUMP_H
|
||||
42
software/apps/finspect/Makefile
Executable file
42
software/apps/finspect/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = finspect
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/finspect/Makefile.old
Executable file
221
software/apps/finspect/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = finspect
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
93
software/apps/finspect/finspect.c
Executable file
93
software/apps/finspect/finspect.c
Executable file
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: finspect.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "finspect.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FINSPECT"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
uint32_t startPos;
|
||||
uint32_t len;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
if(G->fileInUse == 0)
|
||||
{
|
||||
xputs("No file open, buffer contents invalid.\n");
|
||||
} else
|
||||
{
|
||||
startPos = getUintParam(&ptr);
|
||||
len = getUintParam(&ptr);
|
||||
if(len == 0)
|
||||
{
|
||||
xprintf("Illegal <len> value.\n");
|
||||
} else
|
||||
fr = fileBlockDump(startPos, len);
|
||||
}
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/finspect/finspect.h
Executable file
108
software/apps/finspect/finspect.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: finspect.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FINSPECT_H
|
||||
#define FINSPECT_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 1
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FINSPECT_H
|
||||
42
software/apps/flabel/Makefile
Executable file
42
software/apps/flabel/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = flabel
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/flabel/Makefile.old
Executable file
221
software/apps/flabel/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = flabel
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
85
software/apps/flabel/flabel.c
Executable file
85
software/apps/flabel/flabel.c
Executable file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: flabel.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "flabel.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FLABEL"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *labelName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
labelName = getStrParam(&ptr);
|
||||
if(*labelName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <label> value.\n");
|
||||
} else
|
||||
fr = f_setlabel(labelName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/flabel/flabel.h
Executable file
108
software/apps/flabel/flabel.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: flabel.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FLABEL_H
|
||||
#define FLABEL_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 0
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 1
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FLABEL_H
|
||||
42
software/apps/fmkdir/Makefile
Executable file
42
software/apps/fmkdir/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fmkdir
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
221
software/apps/fmkdir/Makefile.old
Executable file
221
software/apps/fmkdir/Makefile.old
Executable file
@@ -0,0 +1,221 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
BASE = zpu-elf
|
||||
CC = $(BASE)-gcc
|
||||
LD = $(BASE)-gcc
|
||||
AS = $(BASE)-as
|
||||
CP = $(BASE)-objcopy
|
||||
DUMP = $(BASE)-objdump
|
||||
|
||||
APP_NAME = fmkdir
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
SWDIR = $(BASEDIR)/software
|
||||
ROMGEN = $(SWDIR)/utils/zpugen
|
||||
IOCPDIR = $(SWDIR)/iocp
|
||||
ZPUTADIR = $(SWDIR)/zputa
|
||||
|
||||
# we use mincrt0.s from here
|
||||
STARTUP_DIR = $(SWDIR)/startup
|
||||
|
||||
# we fetch RAM prologue / epilogue from here
|
||||
RTL_DIR = $(BASEDIR)/devices/BRAM
|
||||
|
||||
# we use printf from here
|
||||
COMMON_DIR = $(SWDIR)/common
|
||||
FATFS_DIR = $(SWDIR)/common/FatFS
|
||||
#PFS_DIR = $(SWDIR)/common/PetitFS
|
||||
INCLUDE_DIR = $(SWDIR)/include
|
||||
|
||||
# Linker mapping file spec file.
|
||||
LINKMAPAPP = $(STARTUP_DIR)/app_standalone.ld
|
||||
|
||||
# Working directory to build object files.
|
||||
BUILD_DIR = $(APP_NAME)_obj
|
||||
|
||||
# Startup code.
|
||||
MINSTARTUP_SRC = $(STARTUP_DIR)/appcrt0.s
|
||||
MINSTARTUP_OBJ = $(patsubst $(STARTUP_DIR)/%.s,$(BUILD_DIR)/%.o,$(MINSTARTUP_SRC))
|
||||
|
||||
# Common modules needed for this app.
|
||||
COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c
|
||||
#COMMON_SRC = $(COMMON_DIR)/syscalls.c $(COMMON_DIR)/malloc.c $(COMMON_DIR)/tools.c #$(COMMON_DIR)/utils.c
|
||||
COMMON_OBJ = $(patsubst $(COMMON_DIR)/%.c,$(BUILD_DIR)/%.o,$(COMMON_SRC))
|
||||
|
||||
MAIN_PRJ_APP = $(APP_NAME)
|
||||
MAIN_SRC = $(APP_NAME).c
|
||||
MAIN_OBJ = $(COMMON_OBJ) $(patsubst %.c,$(BUILD_DIR)/%.o,$(MAIN_SRC))
|
||||
|
||||
# Commandline options for each tool.
|
||||
|
||||
#ZPUOPTS = -mno-poppcrel -mno-pushspadd -mno-callpcrel -mno-byteop -mno-shortop -mno-neg -mno-div -mno-mod # No-neg requires bugfixed toolchain
|
||||
#ZPUOPTS = -mmult -mno-neg -mno-mod # No-neg requires bugfixed toolchain
|
||||
ZPUOPTS =-mmult \
|
||||
-mdiv \
|
||||
-mmod \
|
||||
-mneg \
|
||||
-mloadsp \
|
||||
-mstoresp \
|
||||
-mpushspadd \
|
||||
-mneqbranch \
|
||||
-maddsp \
|
||||
-mashiftrt \
|
||||
-mashiftl \
|
||||
-mlshiftrt \
|
||||
-mcall \
|
||||
-mcallpcrel \
|
||||
-mshortop \
|
||||
-mbyteop \
|
||||
-meq \
|
||||
-mcompare \
|
||||
-mpoppcrel \
|
||||
-mmemreg
|
||||
#CFLAGS = -I. -I$(INCLUDE_DIR) -I$(COMMON_DIR)/. -c -Os $(ZPUOPTS) -DPRINTF_HEX_ONLY -DDISABLE_PRINTF # -DDISABLE_UART_TX -DDISABLE_UART_RX
|
||||
CFLAGS = -I. -I$(COMMON_DIR) -I$(FATFS_DIR) -I$(ZPUTADIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
#CFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -c -O1 -ffunction-sections -fdata-sections $(ZPUOPTS) -DZPU
|
||||
# Enable debug output.
|
||||
OFLAGS += -DDEBUG
|
||||
# Assume loadb as implemented in hardware or software (time penalty).
|
||||
OFLAGS += -DUSELOADB
|
||||
# Dont allow an initialised DATA segment so binary can be located in ROM.
|
||||
#OFLAGS += -DUSE_BOOT_ROM
|
||||
# Remove functionality to create a minimal system for limited space.
|
||||
#OFLAGS += -DMINIMUM_FUNCTIONALITY
|
||||
# Enable SD Card functionality
|
||||
OFLAGS += -DUSE_SDCARD
|
||||
FLAGS_STR = -DFLAGS_STR="$(CFLAGS)"
|
||||
LFLAGS = -nostartfiles -Wl,--gc-sections -Wl,--relax -Os
|
||||
#
|
||||
# Assembler flags.
|
||||
ASFLAGS = -I. -I$(COMMON_DIR) -I$(INCLUDE_DIR) -I$(STARTUP_DIR) --defsym ZPUTA_BASEADDR=0x2000 --defsym ZPUTA_APPADDR=0x50000
|
||||
#
|
||||
|
||||
# Our target.
|
||||
all: $(BUILD_DIR) $(MAIN_PRJ_APP).zpu $(MAIN_PRJ_APP).srec $(MAIN_PRJ_APP).rpt $(MAIN_PRJ_APP).lss $(MAIN_PRJ_APP).dmp $(ROMGEN)
|
||||
|
||||
clean:
|
||||
rm -f $(BUILD_DIR)/*.o *.hex *.lss *.elf *.map *.lst *.srec $(MAIN_PRJ_APP).zpu *~ */*.o *.bin *.srec *.dmp *.vhd *.rpt
|
||||
|
||||
install:
|
||||
@cp $(MAIN_PRJ_APP).zpu $(APP_DIR)/bin/
|
||||
|
||||
# Convert ELF binary to bin file.
|
||||
%.bin: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF binary to app file.
|
||||
%.zpu: %.elf
|
||||
@$(CP) -O binary $< $@
|
||||
|
||||
# Convert ELF to srec format for serial upload.
|
||||
%.srec: %.elf
|
||||
@$(CP) -O srec $< $@
|
||||
|
||||
%.rpt: %.elf
|
||||
@echo ""
|
||||
@echo >$@ -n "Start of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramstart
|
||||
@echo >>$@ -n " BOOT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __boot_end__
|
||||
@echo >>$@ -n " TEXT start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __text_end__
|
||||
@echo >>$@ -n " RODATA start:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __rodata_end__
|
||||
@echo >>$@ -n "End of code:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _ramend
|
||||
@echo >>$@ -n "Start of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _datastart
|
||||
@echo >>$@ -n " DATA start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __data_end__
|
||||
@echo >>$@ -n " BSS start: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_start__
|
||||
@echo >>$@ -n " end: \t"
|
||||
@$(DUMP) -x $< | grep >>$@ __bss_end__
|
||||
@echo >>$@ -n "End of data:\t"
|
||||
@$(DUMP) -x $< | grep >>$@ _dataend
|
||||
@cat $@
|
||||
|
||||
%.dmp: %.elf
|
||||
@$(DUMP) -x $< >>$@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@$(DUMP) -h -S -C $< > $@
|
||||
|
||||
$(ROMGEN): $(SWDIR)/utils/zpugen.c
|
||||
gcc -o $(SWDIR)/utils/zpugen $(SWDIR)/utils/zpugen.c
|
||||
|
||||
# Link - this produces an ELF binary.
|
||||
|
||||
$(MAIN_PRJ_APP).elf: $(MINSTARTUP_OBJ) $(MAIN_OBJ)
|
||||
$(LD) $(LFLAGS) -T $(LINKMAPAPP) -o $@ $+ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(FATFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(PFS_DIR)/%.c Makefile
|
||||
$(CC) $(CFLAGS) $(OFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: $(STARTUP_DIR)/%.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR)
|
||||
|
||||
85
software/apps/fmkdir/fmkdir.c
Executable file
85
software/apps/fmkdir/fmkdir.c
Executable file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fmkdir.c
|
||||
// Created: July 2019
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
// This program implements a loadable appliation which can be loaded from SD card by
|
||||
// the ZPUTA application. The idea is that commands or programs can be stored on the
|
||||
// SD card and executed by ZPUTA just like an OS such as Linux. The primary purpose
|
||||
// is to be able to minimise the size of ZPUTA for applications where minimal ram is
|
||||
// available.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework creation.
|
||||
//
|
||||
// Notes: See Makefile to enable/disable conditional components
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and#or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <zstdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
#include <zpu-types.h>
|
||||
#include "zpu_soc.h"
|
||||
//#include "uart.h"
|
||||
#include "interrupts.h"
|
||||
#include "ff.h" /* Declarations of FatFs API */
|
||||
#include "diskio.h"
|
||||
#include <zstdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xprintf.h"
|
||||
#include "utils.h"
|
||||
#include "zputa_app.h"
|
||||
#include "fmkdir.h"
|
||||
|
||||
// Utility functions.
|
||||
#include "tools.c"
|
||||
|
||||
// Version info.
|
||||
#define VERSION "v1.0"
|
||||
#define VERSION_DATE "18/07/2019"
|
||||
#define APP_NAME "FMKDIR"
|
||||
|
||||
// Main entry and start point of a ZPUTA Application. Only 2 parameters are catered for and a 32bit return code, additional parameters can be added by changing the appcrt0.s
|
||||
// startup code to add them to the stack prior to app() call.
|
||||
//
|
||||
// Return code is saved in _memreg by the C compiler, this is transferred to _memreg in ZPUTA in appcrt0.s prior to return.
|
||||
//
|
||||
uint32_t app(uint32_t param1, uint32_t param2)
|
||||
{
|
||||
// Initialisation.
|
||||
//
|
||||
char *ptr = (char *)param1;
|
||||
char *dirName;
|
||||
uint32_t retCode = 0xffffffff;
|
||||
FRESULT fr;
|
||||
|
||||
dirName = getStrParam(&ptr);
|
||||
if(*dirName == 0x00)
|
||||
{
|
||||
xprintf("Illegal <dir> value.\n");
|
||||
} else
|
||||
fr = f_mkdir(dirName);
|
||||
|
||||
if(fr) { printFSCode(fr); } else { retCode = 0; }
|
||||
|
||||
return(retCode);
|
||||
}
|
||||
108
software/apps/fmkdir/fmkdir.h
Executable file
108
software/apps/fmkdir/fmkdir.h
Executable file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Name: fmkdir.h
|
||||
// Created: July 2018
|
||||
// Author(s): Philip Smart
|
||||
// Description: Standalone App for the ZPU test application.
|
||||
//
|
||||
// Credits:
|
||||
// Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
//
|
||||
// History: July 2019 - Initial framework created.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This source file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This source file is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FMKDIR_H
|
||||
#define FMKDIR_H
|
||||
|
||||
// Constants.
|
||||
|
||||
// Application execution constants.
|
||||
//
|
||||
|
||||
// Components to be embedded in the program.
|
||||
//
|
||||
#define BUILTIN_DEFAULT 1
|
||||
// Disk low level components to be embedded in the program.
|
||||
#define BUILTIN_DISK_DUMP 0
|
||||
#define BUILTIN_DISK_STATUS 0
|
||||
// Disk buffer components to be embedded in the program.
|
||||
#define BUILTIN_BUFFER_DUMP 0
|
||||
#define BUILTIN_BUFFER_EDIT 0
|
||||
#define BUILTIN_BUFFER_READ 0
|
||||
#define BUILTIN_BUFFER_WRITE 0
|
||||
#define BUILTIN_BUFFER_FILL 0
|
||||
#define BUILTIN_BUFFER_LEN 0
|
||||
// Memory components to be embedded in the program.
|
||||
#define BUILTIN_MEM_CLEAR 0
|
||||
#define BUILTIN_MEM_COPY 0
|
||||
#define BUILTIN_MEM_DIFF 0
|
||||
#define BUILTIN_MEM_DUMP 0
|
||||
#define BUILTIN_MEM_PERF 0
|
||||
#define BUILTIN_MEM_SRCH 0
|
||||
#define BUILTIN_MEM_TEST 0
|
||||
#define BUILTIN_MEM_EDIT_BYTES 0
|
||||
#define BUILTIN_MEM_EDIT_HWORD 0
|
||||
#define BUILTIN_MEM_EDIT_WORD 0
|
||||
// Hardware components to be embedded in the program.
|
||||
#define BUILTIN_HW_SHOW_REGISTER 0
|
||||
#define BUILTIN_HW_TEST_TIMERS 0
|
||||
// Filesystem components to be embedded in the program.
|
||||
#define BUILTIN_FS_STATUS 0
|
||||
#define BUILTIN_FS_DIRLIST 0
|
||||
#define BUILTIN_FS_OPEN 0
|
||||
#define BUILTIN_FS_CLOSE 0
|
||||
#define BUILTIN_FS_SEEK 0
|
||||
#define BUILTIN_FS_READ 0
|
||||
#define BUILTIN_FS_CAT 0
|
||||
#define BUILTIN_FS_INSPECT 0
|
||||
#define BUILTIN_FS_WRITE 0
|
||||
#define BUILTIN_FS_TRUNC 0
|
||||
#define BUILTIN_FS_RENAME 0
|
||||
#define BUILTIN_FS_DELETE 0
|
||||
#define BUILTIN_FS_CREATEDIR 1
|
||||
#define BUILTIN_FS_ALLOCBLOCK 0
|
||||
#define BUILTIN_FS_CHANGEATTRIB 0
|
||||
#define BUILTIN_FS_CHANGETIME 0
|
||||
#define BUILTIN_FS_COPY 0
|
||||
#define BUILTIN_FS_CHANGEDIR 0
|
||||
#define BUILTIN_FS_CHANGEDRIVE 0
|
||||
#define BUILTIN_FS_SHOWDIR 0
|
||||
#define BUILTIN_FS_SETLABEL 0
|
||||
#define BUILTIN_FS_CREATEFS 0
|
||||
#define BUILTIN_FS_LOAD 0
|
||||
#define BUILTIN_FS_DUMP 0
|
||||
#define BUILTIN_FS_CONCAT 0
|
||||
#define BUILTIN_FS_XTRACT 0
|
||||
#define BUILTIN_FS_SAVE 0
|
||||
#define BUILTIN_FS_EXEC 0
|
||||
// Test components to be embedded in the program.
|
||||
#define BUILTIN_TST_DHRYSTONE 0
|
||||
#define BUILTIN_TST_COREMARK 0
|
||||
// Miscellaneous components to be embedded in this program.
|
||||
#define BUILTIN_MISC_HELP 0
|
||||
#define BUILTIN_MISC_SETTIME 0
|
||||
|
||||
// Prototypes.
|
||||
uint32_t app(uint32_t, uint32_t);
|
||||
|
||||
// Global scope variables within the ZPUTA memory space.
|
||||
GLOBALS *G;
|
||||
SOC_CONFIG *cfgSoC;
|
||||
|
||||
// Global scope variables in the app memory space.
|
||||
volatile UINT Timer; /* Performance timer (100Hz increment) */
|
||||
|
||||
#endif // FMKDIR_H
|
||||
42
software/apps/fmkfs/Makefile
Executable file
42
software/apps/fmkfs/Makefile
Executable file
@@ -0,0 +1,42 @@
|
||||
#########################################################################################################
|
||||
##
|
||||
## Name: Makefile
|
||||
## Created: July 2019
|
||||
## Author(s): Philip Smart
|
||||
## Description: App Makefile - Build an App for the ZPU Test Application (zputa)
|
||||
## This makefile builds an app which is stored on an SD card and called by the ZPUTA
|
||||
## test application. The app generally is for testing some component where the code is
|
||||
## not built into ZPUTA or memory restrictions prohibit it being built in.
|
||||
##
|
||||
## Credits:
|
||||
## Copyright: (c) 2019 Philip Smart <philip.smart@net2net.org>
|
||||
##
|
||||
## History: July 2019 - Initial Makefile created for template use.
|
||||
##
|
||||
## Notes: Optional component enables:
|
||||
## USELOADB - The Byte write command is implemented in hw#sw so use it.
|
||||
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
|
||||
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
|
||||
## COREMARK_TEST - Add the CoreMark test suite.
|
||||
## DHYRSTONE_TEST - Add the Dhrystone test suite.
|
||||
## USE_SDCARD - Add the SDCard logic.
|
||||
##
|
||||
#########################################################################################################
|
||||
## This source file is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published
|
||||
## by the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This source file is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#########################################################################################################
|
||||
|
||||
APP_NAME = fmkfs
|
||||
APP_DIR = ..
|
||||
BASEDIR = ../../..
|
||||
include $(APP_DIR)/Makefile.inc
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user