OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /neorv32/trunk
    from Rev 20 to Rev 21
    Reverse comparison

Rev 20 → Rev 21

/.ci/sw_check.sh
19,8 → 19,8
# check toolchain
make -C $test_app_dir check
 
# Compile all example projects
make -C $srcdir_examples clean_all compile
# Generate executables for all example projects
make -C $srcdir_examples clean_all exe
 
# Compile and install bootloader
make -C $srcdir_bootloader clean_all info bootloader
/docs/NEORV32.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/rtl/core/neorv32_bootloader_image.vhd
1,5 → 1,5
-- The NEORV32 Processor by Stephan Nolting, https://github.com/stnolting/neorv32
-- Auto-generated memory init file (for BOOTLOADER) from source file <bootloader/bootloader.bin>
-- Auto-generated memory init file (for BOOTLOADER) from source file <bootloader/main.bin>
 
library ieee;
use ieee.std_logic_1164.all;
8,1029 → 8,1002
 
type bootloader_init_image_t is array (0 to 65535) of std_ulogic_vector(31 downto 0);
constant bootloader_init_image : bootloader_init_image_t := (
00000000 => x"ff402583",
00000001 => x"ffc02603",
00000002 => x"00c58133",
00000003 => x"ffc10113",
00000004 => x"00000697",
00000005 => x"04468693",
00000006 => x"30569073",
00000007 => x"00000013",
00000008 => x"00000093",
00000009 => x"00000193",
00000010 => x"00000213",
00000011 => x"00000293",
00000012 => x"00000313",
00000013 => x"00000393",
00000014 => x"00000413",
00000015 => x"00000493",
00000016 => x"00000513",
00000017 => x"00000713",
00000018 => x"00000793",
00000019 => x"054000ef",
00000020 => x"0000006f",
00000021 => x"ff810113",
00000022 => x"00812023",
00000023 => x"00912223",
00000024 => x"34202473",
00000025 => x"02044663",
00000026 => x"34102473",
00000027 => x"00041483",
00000028 => x"0034f493",
00000029 => x"00240413",
00000030 => x"34141073",
00000031 => x"00300413",
00000032 => x"00941863",
00000033 => x"34102473",
00000000 => x"00000093",
00000001 => x"00000113",
00000002 => x"00000193",
00000003 => x"00000213",
00000004 => x"00000293",
00000005 => x"00000313",
00000006 => x"00000393",
00000007 => x"00000413",
00000008 => x"00000493",
00000009 => x"00000693",
00000010 => x"00000713",
00000011 => x"00000793",
00000012 => x"ff402583",
00000013 => x"ffc02603",
00000014 => x"00c58133",
00000015 => x"ffc10113",
00000016 => x"00010413",
00000017 => x"00000597",
00000018 => x"02458593",
00000019 => x"30559073",
00000020 => x"00000513",
00000021 => x"00000593",
00000022 => x"05c000ef",
00000023 => x"30047073",
00000024 => x"10500073",
00000025 => x"0000006f",
00000026 => x"ff810113",
00000027 => x"00812023",
00000028 => x"00912223",
00000029 => x"34202473",
00000030 => x"02044663",
00000031 => x"34102473",
00000032 => x"00041483",
00000033 => x"0034f493",
00000034 => x"00240413",
00000035 => x"34141073",
00000036 => x"00012483",
00000037 => x"00412403",
00000038 => x"00810113",
00000039 => x"30200073",
00000040 => x"fd010113",
00000041 => x"02112623",
00000042 => x"02812423",
00000043 => x"02912223",
00000044 => x"03212023",
00000045 => x"01312e23",
00000046 => x"01412c23",
00000047 => x"01512a23",
00000048 => x"01612823",
00000049 => x"01712623",
00000050 => x"01812423",
00000051 => x"f8002823",
00000052 => x"f8002a23",
00000053 => x"1e1000ef",
00000054 => x"4cd000ef",
00000055 => x"435000ef",
00000056 => x"4ed000ef",
00000057 => x"4d5000ef",
00000058 => x"fe002403",
00000059 => x"026267b7",
00000060 => x"9ff78793",
00000061 => x"00000713",
00000062 => x"00000693",
00000063 => x"00000613",
00000064 => x"00000593",
00000065 => x"00200513",
00000066 => x"0087f463",
00000067 => x"00400513",
00000068 => x"3b5000ef",
00000069 => x"00005537",
00000070 => x"00000613",
00000071 => x"00000593",
00000072 => x"b0050513",
00000073 => x"29d000ef",
00000074 => x"255000ef",
00000075 => x"00245793",
00000076 => x"00a78533",
00000077 => x"00f537b3",
00000078 => x"00b785b3",
00000079 => x"26d000ef",
00000080 => x"ffff07b7",
00000081 => x"44c78793",
00000082 => x"30579073",
00000083 => x"08000793",
00000084 => x"30479073",
00000085 => x"30046073",
00000086 => x"00100513",
00000087 => x"441000ef",
00000088 => x"00000793",
00000089 => x"34079073",
00000090 => x"ffff1537",
00000091 => x"f1450513",
00000092 => x"2fd000ef",
00000093 => x"151000ef",
00000094 => x"ffff1537",
00000095 => x"f4c50513",
00000096 => x"2ed000ef",
00000097 => x"fe002503",
00000098 => x"254000ef",
00000099 => x"ffff1537",
00000100 => x"f5450513",
00000101 => x"2d9000ef",
00000102 => x"fe402503",
00000103 => x"240000ef",
00000104 => x"ffff1537",
00000105 => x"f6050513",
00000106 => x"2c5000ef",
00000107 => x"30102573",
00000108 => x"22c000ef",
00000109 => x"ffff1537",
00000110 => x"f6850513",
00000111 => x"2b1000ef",
00000112 => x"fe802503",
00000113 => x"ffff14b7",
00000114 => x"00341413",
00000115 => x"210000ef",
00000116 => x"ffff1537",
00000117 => x"f7050513",
00000118 => x"295000ef",
00000119 => x"ff802503",
00000120 => x"ffff1937",
00000121 => x"1f8000ef",
00000122 => x"f7848513",
00000123 => x"281000ef",
00000124 => x"ff002503",
00000125 => x"1e8000ef",
00000126 => x"ffff1537",
00000127 => x"f8450513",
00000128 => x"26d000ef",
00000129 => x"ffc02503",
00000130 => x"1d4000ef",
00000131 => x"f7848513",
00000132 => x"25d000ef",
00000133 => x"ff402503",
00000134 => x"1c4000ef",
00000135 => x"ffff1537",
00000136 => x"f8c50513",
00000137 => x"249000ef",
00000138 => x"155000ef",
00000139 => x"00a404b3",
00000140 => x"0084b433",
00000141 => x"00b40433",
00000142 => x"fa402783",
00000143 => x"0607d263",
00000144 => x"ffff1537",
00000145 => x"fb850513",
00000146 => x"225000ef",
00000147 => x"ffff1937",
00000148 => x"0d4000ef",
00000149 => x"ffff19b7",
00000150 => x"07200a13",
00000151 => x"06800a93",
00000152 => x"07500b13",
00000153 => x"07300b93",
00000154 => x"ffff14b7",
00000155 => x"ffff1c37",
00000156 => x"fc490513",
00000157 => x"1f9000ef",
00000158 => x"1e5000ef",
00000159 => x"00050413",
00000160 => x"1cd000ef",
00000161 => x"fb498513",
00000162 => x"1e5000ef",
00000163 => x"03441e63",
00000164 => x"30047073",
00000165 => x"ffff02b7",
00000166 => x"00028067",
00000167 => x"0000006f",
00000168 => x"0dd000ef",
00000169 => x"f885eae3",
00000170 => x"00b41463",
00000171 => x"f89566e3",
00000172 => x"00100513",
00000173 => x"444000ef",
00000174 => x"fb490513",
00000175 => x"1b1000ef",
00000176 => x"070000ef",
00000177 => x"f75ff06f",
00000178 => x"01541663",
00000179 => x"058000ef",
00000180 => x"fa1ff06f",
00000181 => x"00000513",
00000182 => x"01640e63",
00000183 => x"01741663",
00000184 => x"65c000ef",
00000185 => x"f8dff06f",
00000186 => x"06c00793",
00000187 => x"00f41863",
00000188 => x"00100513",
00000189 => x"404000ef",
00000190 => x"f79ff06f",
00000191 => x"06500793",
00000192 => x"00f41663",
00000193 => x"02c000ef",
00000194 => x"f69ff06f",
00000195 => x"03f00793",
00000196 => x"fccc0513",
00000197 => x"00f40463",
00000198 => x"fe048513",
00000199 => x"151000ef",
00000200 => x"f51ff06f",
00000201 => x"ffff1537",
00000202 => x"de450513",
00000203 => x"1410006f",
00000204 => x"340027f3",
00000205 => x"00079863",
00000206 => x"ffff1537",
00000207 => x"e4850513",
00000208 => x"12d0006f",
00000209 => x"ff010113",
00000210 => x"00112623",
00000211 => x"30047073",
00000212 => x"00000793",
00000213 => x"30479073",
00000214 => x"ffff1537",
00000215 => x"e6450513",
00000216 => x"10d000ef",
00000217 => x"fa002783",
00000218 => x"fe07cee3",
00000219 => x"b0001073",
00000220 => x"b8001073",
00000221 => x"b0201073",
00000222 => x"b8201073",
00000223 => x"ff002783",
00000224 => x"00078067",
00000225 => x"0000006f",
00000226 => x"ff010113",
00000227 => x"00812423",
00000228 => x"00050413",
00000229 => x"ffff1537",
00000230 => x"e7450513",
00000231 => x"00112623",
00000232 => x"0cd000ef",
00000233 => x"00500793",
00000234 => x"0287e263",
00000235 => x"03040513",
00000236 => x"0ff57513",
00000237 => x"099000ef",
00000238 => x"30047073",
00000239 => x"00100513",
00000240 => x"1dd000ef",
00000241 => x"10500073",
00000242 => x"0000006f",
00000243 => x"ffff1537",
00000244 => x"e7c50513",
00000245 => x"099000ef",
00000246 => x"fe1ff06f",
00000247 => x"fe010113",
00000248 => x"01212823",
00000249 => x"00050913",
00000250 => x"ffff1537",
00000251 => x"00912a23",
00000252 => x"e8450513",
00000253 => x"ffff14b7",
00000254 => x"00812c23",
00000255 => x"01312623",
00000256 => x"00112e23",
00000257 => x"01c00413",
00000258 => x"065000ef",
00000259 => x"fec48493",
00000260 => x"ffc00993",
00000261 => x"008957b3",
00000262 => x"00f7f793",
00000263 => x"00f487b3",
00000264 => x"0007c503",
00000265 => x"ffc40413",
00000266 => x"025000ef",
00000267 => x"ff3414e3",
00000268 => x"01c12083",
00000269 => x"01812403",
00000270 => x"01412483",
00000271 => x"01012903",
00000272 => x"00c12983",
00000273 => x"02010113",
00000274 => x"00008067",
00000275 => x"fb010113",
00000276 => x"04112623",
00000277 => x"04512423",
00000278 => x"04612223",
00000279 => x"04712023",
00000280 => x"02812e23",
00000281 => x"02a12c23",
00000282 => x"02b12a23",
00000283 => x"02c12823",
00000284 => x"02d12623",
00000285 => x"02e12423",
00000286 => x"02f12223",
00000287 => x"03012023",
00000288 => x"01112e23",
00000289 => x"01c12c23",
00000290 => x"01d12a23",
00000291 => x"01e12823",
00000292 => x"01f12623",
00000293 => x"34202473",
00000294 => x"800007b7",
00000295 => x"00778793",
00000296 => x"02f40a63",
00000297 => x"ffff1537",
00000298 => x"e8850513",
00000299 => x"7c0000ef",
00000300 => x"00040513",
00000301 => x"f29ff0ef",
00000302 => x"ffff1537",
00000303 => x"e9850513",
00000304 => x"7ac000ef",
00000305 => x"34102573",
00000306 => x"f15ff0ef",
00000307 => x"00500513",
00000308 => x"eb9ff0ef",
00000309 => x"00000513",
00000310 => x"0a5000ef",
00000311 => x"6a0000ef",
00000312 => x"fe002783",
00000313 => x"0027d793",
00000314 => x"00a78533",
00000315 => x"00f537b3",
00000316 => x"00b785b3",
00000317 => x"6b4000ef",
00000318 => x"03c12403",
00000319 => x"04c12083",
00000320 => x"04812283",
00000321 => x"04412303",
00000322 => x"04012383",
00000323 => x"03812503",
00000324 => x"03412583",
00000325 => x"03012603",
00000326 => x"02c12683",
00000327 => x"02812703",
00000328 => x"02412783",
00000329 => x"02012803",
00000330 => x"01c12883",
00000331 => x"01812e03",
00000332 => x"01412e83",
00000333 => x"01012f03",
00000334 => x"00c12f83",
00000335 => x"05010113",
00000336 => x"30200073",
00000337 => x"ff010113",
00000338 => x"00000513",
00000339 => x"00112623",
00000340 => x"00812423",
00000341 => x"7d0000ef",
00000342 => x"00500513",
00000343 => x"00d000ef",
00000344 => x"00000513",
00000345 => x"005000ef",
00000346 => x"00050413",
00000347 => x"00000513",
00000348 => x"7d4000ef",
00000349 => x"00c12083",
00000350 => x"0ff47513",
00000351 => x"00812403",
00000352 => x"01010113",
00000353 => x"00008067",
00000354 => x"ff010113",
00000355 => x"00000513",
00000356 => x"00112623",
00000357 => x"00812423",
00000358 => x"78c000ef",
00000359 => x"09e00513",
00000360 => x"7c8000ef",
00000361 => x"00000513",
00000362 => x"7c0000ef",
00000363 => x"00050413",
00000364 => x"00000513",
00000365 => x"790000ef",
00000366 => x"00c12083",
00000367 => x"0ff47513",
00000368 => x"00812403",
00000369 => x"01010113",
00000370 => x"00008067",
00000371 => x"ff010113",
00000372 => x"00000513",
00000373 => x"00112623",
00000374 => x"74c000ef",
00000375 => x"00600513",
00000376 => x"788000ef",
00000377 => x"00c12083",
00000378 => x"00000513",
00000379 => x"01010113",
00000380 => x"7540006f",
00000381 => x"ff010113",
00000382 => x"00812423",
00000383 => x"00050413",
00000384 => x"01055513",
00000385 => x"0ff57513",
00000386 => x"00112623",
00000387 => x"75c000ef",
00000388 => x"00845513",
00000389 => x"0ff57513",
00000390 => x"750000ef",
00000391 => x"0ff47513",
00000392 => x"00812403",
00000393 => x"00c12083",
00000394 => x"01010113",
00000395 => x"73c0006f",
00000396 => x"ff010113",
00000397 => x"00812423",
00000398 => x"00050413",
00000399 => x"00000513",
00000400 => x"00112623",
00000401 => x"6e0000ef",
00000402 => x"00300513",
00000403 => x"71c000ef",
00000404 => x"00040513",
00000405 => x"fa1ff0ef",
00000406 => x"00000513",
00000407 => x"70c000ef",
00000408 => x"00050413",
00000409 => x"00000513",
00000410 => x"6dc000ef",
00000411 => x"00c12083",
00000412 => x"0ff47513",
00000413 => x"00812403",
00000414 => x"01010113",
00000415 => x"00008067",
00000416 => x"fd010113",
00000417 => x"02812423",
00000418 => x"02912223",
00000419 => x"03212023",
00000420 => x"01312e23",
00000421 => x"01412c23",
00000422 => x"02112623",
00000423 => x"00050913",
00000424 => x"00058993",
00000425 => x"00c10493",
00000426 => x"00000413",
00000427 => x"00400a13",
00000428 => x"02091e63",
00000429 => x"5a8000ef",
00000430 => x"00a481a3",
00000431 => x"00140413",
00000432 => x"fff48493",
00000433 => x"ff4416e3",
00000434 => x"02c12083",
00000435 => x"02812403",
00000436 => x"00c12503",
00000437 => x"02412483",
00000438 => x"02012903",
00000439 => x"01c12983",
00000440 => x"01812a03",
00000441 => x"03010113",
00000442 => x"00008067",
00000443 => x"00898533",
00000444 => x"f41ff0ef",
00000445 => x"fc5ff06f",
00000446 => x"fd010113",
00000447 => x"02812423",
00000448 => x"fe802403",
00000449 => x"02112623",
00000450 => x"02912223",
00000451 => x"03212023",
00000452 => x"01312e23",
00000453 => x"01412c23",
00000454 => x"01512a23",
00000455 => x"01612823",
00000456 => x"01712623",
00000457 => x"00847413",
00000458 => x"00040663",
00000459 => x"00400513",
00000460 => x"c59ff0ef",
00000461 => x"00050493",
00000462 => x"02051863",
00000463 => x"ffff1537",
00000464 => x"ea050513",
00000465 => x"528000ef",
00000466 => x"008005b7",
00000467 => x"00048513",
00000468 => x"f31ff0ef",
00000469 => x"4788d7b7",
00000470 => x"afe78793",
00000471 => x"02f50463",
00000472 => x"00000513",
00000473 => x"fcdff06f",
00000474 => x"ffff1537",
00000475 => x"ec050513",
00000476 => x"4fc000ef",
00000477 => x"e15ff0ef",
00000478 => x"fc0518e3",
00000479 => x"00300513",
00000480 => x"fb1ff06f",
00000481 => x"00800a37",
00000482 => x"004a0593",
00000483 => x"00048513",
00000484 => x"ef1ff0ef",
00000485 => x"00050913",
00000486 => x"008a0593",
00000487 => x"00048513",
00000488 => x"ee1ff0ef",
00000489 => x"ff802783",
00000490 => x"00050a93",
00000491 => x"00100513",
00000492 => x"f927e0e3",
00000493 => x"ff002b83",
00000494 => x"ffc97b13",
00000495 => x"00000993",
00000496 => x"00ca0a13",
00000497 => x"014985b3",
00000498 => x"053b1663",
00000499 => x"01540433",
00000500 => x"00200513",
00000501 => x"f4041ee3",
00000502 => x"ffff1537",
00000503 => x"ecc50513",
00000504 => x"48c000ef",
00000505 => x"34091073",
00000506 => x"02c12083",
00000507 => x"02812403",
00000508 => x"02412483",
00000509 => x"02012903",
00000510 => x"01c12983",
00000511 => x"01812a03",
00000512 => x"01412a83",
00000513 => x"01012b03",
00000514 => x"00c12b83",
00000515 => x"03010113",
00000516 => x"00008067",
00000517 => x"00048513",
00000518 => x"e69ff0ef",
00000519 => x"013b87b3",
00000520 => x"00a40433",
00000521 => x"00a7a023",
00000522 => x"00498993",
00000523 => x"f99ff06f",
00000524 => x"ff010113",
00000525 => x"00112623",
00000526 => x"00812423",
00000527 => x"00912223",
00000528 => x"00058413",
00000529 => x"00050493",
00000530 => x"d85ff0ef",
00000531 => x"00000513",
00000532 => x"4d4000ef",
00000533 => x"00200513",
00000534 => x"510000ef",
00000535 => x"00048513",
00000536 => x"d95ff0ef",
00000537 => x"00040513",
00000538 => x"500000ef",
00000539 => x"00000513",
00000540 => x"4d4000ef",
00000541 => x"cd1ff0ef",
00000542 => x"00157513",
00000543 => x"fe051ce3",
00000544 => x"00c12083",
00000545 => x"00812403",
00000546 => x"00412483",
00000547 => x"01010113",
00000548 => x"00008067",
00000549 => x"fe010113",
00000550 => x"00812c23",
00000551 => x"00912a23",
00000552 => x"01212823",
00000553 => x"00112e23",
00000554 => x"00b12623",
00000555 => x"00300413",
00000556 => x"00350493",
00000557 => x"fff00913",
00000558 => x"00c10793",
00000559 => x"008787b3",
00000560 => x"0007c583",
00000561 => x"40848533",
00000562 => x"fff40413",
00000563 => x"f65ff0ef",
00000564 => x"ff2414e3",
00000565 => x"01c12083",
00000566 => x"01812403",
00000567 => x"01412483",
00000568 => x"01012903",
00000569 => x"02010113",
00000570 => x"00008067",
00000571 => x"ff010113",
00000572 => x"00112623",
00000573 => x"00812423",
00000574 => x"00050413",
00000575 => x"cd1ff0ef",
00000576 => x"00000513",
00000577 => x"420000ef",
00000578 => x"0d800513",
00000579 => x"45c000ef",
00000580 => x"00040513",
00000581 => x"ce1ff0ef",
00000582 => x"00000513",
00000583 => x"428000ef",
00000584 => x"c25ff0ef",
00000585 => x"00157513",
00000586 => x"fe051ce3",
00000587 => x"00c12083",
00000588 => x"00812403",
00000589 => x"01010113",
00000590 => x"00008067",
00000591 => x"fe010113",
00000592 => x"00112e23",
00000593 => x"00812c23",
00000594 => x"00912a23",
00000595 => x"01212823",
00000596 => x"01312623",
00000597 => x"01412423",
00000598 => x"01512223",
00000599 => x"34002473",
00000600 => x"02041863",
00000601 => x"ffff1537",
00000602 => x"e4850513",
00000603 => x"01812403",
00000604 => x"01c12083",
00000605 => x"01412483",
00000606 => x"01012903",
00000607 => x"00c12983",
00000608 => x"00812a03",
00000609 => x"00412a83",
00000610 => x"02010113",
00000611 => x"2e00006f",
00000612 => x"ffff1537",
00000613 => x"ed050513",
00000614 => x"2d4000ef",
00000615 => x"00040513",
00000616 => x"a3dff0ef",
00000617 => x"ffff1537",
00000618 => x"edc50513",
00000619 => x"2c0000ef",
00000620 => x"00800537",
00000621 => x"a29ff0ef",
00000622 => x"ffff1537",
00000623 => x"ef850513",
00000624 => x"2ac000ef",
00000625 => x"298000ef",
00000626 => x"00050493",
00000627 => x"280000ef",
00000628 => x"07900793",
00000629 => x"0af49e63",
00000630 => x"bb1ff0ef",
00000631 => x"00051663",
00000632 => x"00300513",
00000633 => x"9a5ff0ef",
00000634 => x"ffff1537",
00000635 => x"f0450513",
00000636 => x"01045493",
00000637 => x"278000ef",
00000638 => x"00148493",
00000639 => x"00800937",
00000640 => x"fff00993",
00000641 => x"00010a37",
00000642 => x"fff48493",
00000643 => x"07349063",
00000644 => x"4788d5b7",
00000645 => x"afe58593",
00000036 => x"00300413",
00000037 => x"00941863",
00000038 => x"34102473",
00000039 => x"00240413",
00000040 => x"34141073",
00000041 => x"00012483",
00000042 => x"00412403",
00000043 => x"00810113",
00000044 => x"30200073",
00000045 => x"fd010113",
00000046 => x"02812423",
00000047 => x"fe002403",
00000048 => x"026267b7",
00000049 => x"02112623",
00000050 => x"02912223",
00000051 => x"03212023",
00000052 => x"01312e23",
00000053 => x"01412c23",
00000054 => x"01512a23",
00000055 => x"01612823",
00000056 => x"01712623",
00000057 => x"01812423",
00000058 => x"9ff78793",
00000059 => x"00000713",
00000060 => x"00000693",
00000061 => x"00000613",
00000062 => x"00000593",
00000063 => x"00200513",
00000064 => x"0087f463",
00000065 => x"00400513",
00000066 => x"3a5000ef",
00000067 => x"00005537",
00000068 => x"00000613",
00000069 => x"00000593",
00000070 => x"b0050513",
00000071 => x"28d000ef",
00000072 => x"245000ef",
00000073 => x"00245793",
00000074 => x"00a78533",
00000075 => x"00f537b3",
00000076 => x"00b785b3",
00000077 => x"25d000ef",
00000078 => x"ffff07b7",
00000079 => x"44478793",
00000080 => x"30579073",
00000081 => x"08000793",
00000082 => x"30479073",
00000083 => x"30046073",
00000084 => x"00100513",
00000085 => x"41d000ef",
00000086 => x"00000793",
00000087 => x"34079073",
00000088 => x"ffff1537",
00000089 => x"ea850513",
00000090 => x"2ed000ef",
00000091 => x"141000ef",
00000092 => x"ffff1537",
00000093 => x"ee050513",
00000094 => x"2dd000ef",
00000095 => x"fe002503",
00000096 => x"254000ef",
00000097 => x"ffff1537",
00000098 => x"ee850513",
00000099 => x"2c9000ef",
00000100 => x"fe402503",
00000101 => x"240000ef",
00000102 => x"ffff1537",
00000103 => x"ef450513",
00000104 => x"2b5000ef",
00000105 => x"30102573",
00000106 => x"22c000ef",
00000107 => x"ffff1537",
00000108 => x"efc50513",
00000109 => x"2a1000ef",
00000110 => x"fe802503",
00000111 => x"ffff14b7",
00000112 => x"00341413",
00000113 => x"210000ef",
00000114 => x"ffff1537",
00000115 => x"f0450513",
00000116 => x"285000ef",
00000117 => x"ff802503",
00000118 => x"ffff1937",
00000119 => x"1f8000ef",
00000120 => x"f0c48513",
00000121 => x"271000ef",
00000122 => x"ff002503",
00000123 => x"1e8000ef",
00000124 => x"ffff1537",
00000125 => x"f1850513",
00000126 => x"25d000ef",
00000127 => x"ffc02503",
00000128 => x"1d4000ef",
00000129 => x"f0c48513",
00000130 => x"24d000ef",
00000131 => x"ff402503",
00000132 => x"1c4000ef",
00000133 => x"ffff1537",
00000134 => x"f2050513",
00000135 => x"239000ef",
00000136 => x"145000ef",
00000137 => x"00a404b3",
00000138 => x"0084b433",
00000139 => x"00b40433",
00000140 => x"fa402783",
00000141 => x"0607d263",
00000142 => x"ffff1537",
00000143 => x"f4c50513",
00000144 => x"215000ef",
00000145 => x"ffff1937",
00000146 => x"0d4000ef",
00000147 => x"ffff19b7",
00000148 => x"07200a13",
00000149 => x"06800a93",
00000150 => x"07500b13",
00000151 => x"07300b93",
00000152 => x"ffff14b7",
00000153 => x"ffff1c37",
00000154 => x"f5890513",
00000155 => x"1e9000ef",
00000156 => x"1d5000ef",
00000157 => x"00050413",
00000158 => x"1bd000ef",
00000159 => x"f4898513",
00000160 => x"1d5000ef",
00000161 => x"03441e63",
00000162 => x"30047073",
00000163 => x"ffff02b7",
00000164 => x"00028067",
00000165 => x"0000006f",
00000166 => x"0cd000ef",
00000167 => x"f885eae3",
00000168 => x"00b41463",
00000169 => x"f89566e3",
00000170 => x"00100513",
00000171 => x"444000ef",
00000172 => x"f4890513",
00000173 => x"1a1000ef",
00000174 => x"070000ef",
00000175 => x"f75ff06f",
00000176 => x"01541663",
00000177 => x"058000ef",
00000178 => x"fa1ff06f",
00000179 => x"00000513",
00000180 => x"01640e63",
00000181 => x"01741663",
00000182 => x"65c000ef",
00000183 => x"f8dff06f",
00000184 => x"06c00793",
00000185 => x"00f41863",
00000186 => x"00100513",
00000187 => x"404000ef",
00000188 => x"f79ff06f",
00000189 => x"06500793",
00000190 => x"00f41663",
00000191 => x"02c000ef",
00000192 => x"f69ff06f",
00000193 => x"03f00793",
00000194 => x"f60c0513",
00000195 => x"00f40463",
00000196 => x"f7448513",
00000197 => x"141000ef",
00000198 => x"f51ff06f",
00000199 => x"ffff1537",
00000200 => x"d7850513",
00000201 => x"1310006f",
00000202 => x"340027f3",
00000203 => x"00079863",
00000204 => x"ffff1537",
00000205 => x"ddc50513",
00000206 => x"11d0006f",
00000207 => x"ff010113",
00000208 => x"00112623",
00000209 => x"30047073",
00000210 => x"00000793",
00000211 => x"30479073",
00000212 => x"ffff1537",
00000213 => x"df850513",
00000214 => x"0fd000ef",
00000215 => x"fa002783",
00000216 => x"fe07cee3",
00000217 => x"b0001073",
00000218 => x"b8001073",
00000219 => x"b0201073",
00000220 => x"b8201073",
00000221 => x"ff002783",
00000222 => x"00078067",
00000223 => x"0000006f",
00000224 => x"ff010113",
00000225 => x"00812423",
00000226 => x"00050413",
00000227 => x"ffff1537",
00000228 => x"e0850513",
00000229 => x"00112623",
00000230 => x"0bd000ef",
00000231 => x"00500793",
00000232 => x"0287e263",
00000233 => x"03040513",
00000234 => x"0ff57513",
00000235 => x"089000ef",
00000236 => x"30047073",
00000237 => x"00100513",
00000238 => x"1b9000ef",
00000239 => x"10500073",
00000240 => x"0000006f",
00000241 => x"ffff1537",
00000242 => x"e1050513",
00000243 => x"089000ef",
00000244 => x"fe1ff06f",
00000245 => x"fe010113",
00000246 => x"01212823",
00000247 => x"00050913",
00000248 => x"ffff1537",
00000249 => x"00912a23",
00000250 => x"e1850513",
00000251 => x"ffff14b7",
00000252 => x"00812c23",
00000253 => x"01312623",
00000254 => x"00112e23",
00000255 => x"01c00413",
00000256 => x"055000ef",
00000257 => x"f8048493",
00000258 => x"ffc00993",
00000259 => x"008957b3",
00000260 => x"00f7f793",
00000261 => x"00f487b3",
00000262 => x"0007c503",
00000263 => x"ffc40413",
00000264 => x"015000ef",
00000265 => x"ff3414e3",
00000266 => x"01c12083",
00000267 => x"01812403",
00000268 => x"01412483",
00000269 => x"01012903",
00000270 => x"00c12983",
00000271 => x"02010113",
00000272 => x"00008067",
00000273 => x"fb010113",
00000274 => x"04112623",
00000275 => x"04512423",
00000276 => x"04612223",
00000277 => x"04712023",
00000278 => x"02812e23",
00000279 => x"02a12c23",
00000280 => x"02b12a23",
00000281 => x"02c12823",
00000282 => x"02d12623",
00000283 => x"02e12423",
00000284 => x"02f12223",
00000285 => x"03012023",
00000286 => x"01112e23",
00000287 => x"01c12c23",
00000288 => x"01d12a23",
00000289 => x"01e12823",
00000290 => x"01f12623",
00000291 => x"34202473",
00000292 => x"800007b7",
00000293 => x"00778793",
00000294 => x"02f40a63",
00000295 => x"ffff1537",
00000296 => x"e1c50513",
00000297 => x"7b0000ef",
00000298 => x"00040513",
00000299 => x"f29ff0ef",
00000300 => x"ffff1537",
00000301 => x"e2c50513",
00000302 => x"79c000ef",
00000303 => x"34102573",
00000304 => x"f15ff0ef",
00000305 => x"00500513",
00000306 => x"eb9ff0ef",
00000307 => x"00000513",
00000308 => x"081000ef",
00000309 => x"690000ef",
00000310 => x"fe002783",
00000311 => x"0027d793",
00000312 => x"00a78533",
00000313 => x"00f537b3",
00000314 => x"00b785b3",
00000315 => x"6a4000ef",
00000316 => x"03c12403",
00000317 => x"04c12083",
00000318 => x"04812283",
00000319 => x"04412303",
00000320 => x"04012383",
00000321 => x"03812503",
00000322 => x"03412583",
00000323 => x"03012603",
00000324 => x"02c12683",
00000325 => x"02812703",
00000326 => x"02412783",
00000327 => x"02012803",
00000328 => x"01c12883",
00000329 => x"01812e03",
00000330 => x"01412e83",
00000331 => x"01012f03",
00000332 => x"00c12f83",
00000333 => x"05010113",
00000334 => x"30200073",
00000335 => x"ff010113",
00000336 => x"00000513",
00000337 => x"00112623",
00000338 => x"00812423",
00000339 => x"7ac000ef",
00000340 => x"00500513",
00000341 => x"7e8000ef",
00000342 => x"00000513",
00000343 => x"7e0000ef",
00000344 => x"00050413",
00000345 => x"00000513",
00000346 => x"7b0000ef",
00000347 => x"00c12083",
00000348 => x"0ff47513",
00000349 => x"00812403",
00000350 => x"01010113",
00000351 => x"00008067",
00000352 => x"ff010113",
00000353 => x"00000513",
00000354 => x"00112623",
00000355 => x"00812423",
00000356 => x"768000ef",
00000357 => x"09e00513",
00000358 => x"7a4000ef",
00000359 => x"00000513",
00000360 => x"79c000ef",
00000361 => x"00050413",
00000362 => x"00000513",
00000363 => x"76c000ef",
00000364 => x"00c12083",
00000365 => x"0ff47513",
00000366 => x"00812403",
00000367 => x"01010113",
00000368 => x"00008067",
00000369 => x"ff010113",
00000370 => x"00000513",
00000371 => x"00112623",
00000372 => x"728000ef",
00000373 => x"00600513",
00000374 => x"764000ef",
00000375 => x"00c12083",
00000376 => x"00000513",
00000377 => x"01010113",
00000378 => x"7300006f",
00000379 => x"ff010113",
00000380 => x"00812423",
00000381 => x"00050413",
00000382 => x"01055513",
00000383 => x"0ff57513",
00000384 => x"00112623",
00000385 => x"738000ef",
00000386 => x"00845513",
00000387 => x"0ff57513",
00000388 => x"72c000ef",
00000389 => x"0ff47513",
00000390 => x"00812403",
00000391 => x"00c12083",
00000392 => x"01010113",
00000393 => x"7180006f",
00000394 => x"ff010113",
00000395 => x"00812423",
00000396 => x"00050413",
00000397 => x"00000513",
00000398 => x"00112623",
00000399 => x"6bc000ef",
00000400 => x"00300513",
00000401 => x"6f8000ef",
00000402 => x"00040513",
00000403 => x"fa1ff0ef",
00000404 => x"00000513",
00000405 => x"6e8000ef",
00000406 => x"00050413",
00000407 => x"00000513",
00000408 => x"6b8000ef",
00000409 => x"00c12083",
00000410 => x"0ff47513",
00000411 => x"00812403",
00000412 => x"01010113",
00000413 => x"00008067",
00000414 => x"fd010113",
00000415 => x"02812423",
00000416 => x"02912223",
00000417 => x"03212023",
00000418 => x"01312e23",
00000419 => x"01412c23",
00000420 => x"02112623",
00000421 => x"00050913",
00000422 => x"00058993",
00000423 => x"00c10493",
00000424 => x"00000413",
00000425 => x"00400a13",
00000426 => x"02091e63",
00000427 => x"598000ef",
00000428 => x"00a481a3",
00000429 => x"00140413",
00000430 => x"fff48493",
00000431 => x"ff4416e3",
00000432 => x"02c12083",
00000433 => x"02812403",
00000434 => x"00c12503",
00000435 => x"02412483",
00000436 => x"02012903",
00000437 => x"01c12983",
00000438 => x"01812a03",
00000439 => x"03010113",
00000440 => x"00008067",
00000441 => x"00898533",
00000442 => x"f41ff0ef",
00000443 => x"fc5ff06f",
00000444 => x"fd010113",
00000445 => x"02812423",
00000446 => x"fe802403",
00000447 => x"02112623",
00000448 => x"02912223",
00000449 => x"03212023",
00000450 => x"01312e23",
00000451 => x"01412c23",
00000452 => x"01512a23",
00000453 => x"01612823",
00000454 => x"01712623",
00000455 => x"00847413",
00000456 => x"00040663",
00000457 => x"00400513",
00000458 => x"c59ff0ef",
00000459 => x"00050493",
00000460 => x"02051863",
00000461 => x"ffff1537",
00000462 => x"e3450513",
00000463 => x"518000ef",
00000464 => x"008005b7",
00000465 => x"00048513",
00000466 => x"f31ff0ef",
00000467 => x"4788d7b7",
00000468 => x"afe78793",
00000469 => x"02f50463",
00000470 => x"00000513",
00000471 => x"fcdff06f",
00000472 => x"ffff1537",
00000473 => x"e5450513",
00000474 => x"4ec000ef",
00000475 => x"e15ff0ef",
00000476 => x"fc0518e3",
00000477 => x"00300513",
00000478 => x"fb1ff06f",
00000479 => x"00800a37",
00000480 => x"004a0593",
00000481 => x"00048513",
00000482 => x"ef1ff0ef",
00000483 => x"00050913",
00000484 => x"008a0593",
00000485 => x"00048513",
00000486 => x"ee1ff0ef",
00000487 => x"ff802783",
00000488 => x"00050a93",
00000489 => x"00100513",
00000490 => x"f927e0e3",
00000491 => x"ff002b83",
00000492 => x"ffc97b13",
00000493 => x"00000993",
00000494 => x"00ca0a13",
00000495 => x"014985b3",
00000496 => x"053b1663",
00000497 => x"01540433",
00000498 => x"00200513",
00000499 => x"f4041ee3",
00000500 => x"ffff1537",
00000501 => x"e6050513",
00000502 => x"47c000ef",
00000503 => x"34091073",
00000504 => x"02c12083",
00000505 => x"02812403",
00000506 => x"02412483",
00000507 => x"02012903",
00000508 => x"01c12983",
00000509 => x"01812a03",
00000510 => x"01412a83",
00000511 => x"01012b03",
00000512 => x"00c12b83",
00000513 => x"03010113",
00000514 => x"00008067",
00000515 => x"00048513",
00000516 => x"e69ff0ef",
00000517 => x"013b87b3",
00000518 => x"00a40433",
00000519 => x"00a7a023",
00000520 => x"00498993",
00000521 => x"f99ff06f",
00000522 => x"ff010113",
00000523 => x"00112623",
00000524 => x"00812423",
00000525 => x"00912223",
00000526 => x"00058413",
00000527 => x"00050493",
00000528 => x"d85ff0ef",
00000529 => x"00000513",
00000530 => x"4b0000ef",
00000531 => x"00200513",
00000532 => x"4ec000ef",
00000533 => x"00048513",
00000534 => x"d95ff0ef",
00000535 => x"00040513",
00000536 => x"4dc000ef",
00000537 => x"00000513",
00000538 => x"4b0000ef",
00000539 => x"cd1ff0ef",
00000540 => x"00157513",
00000541 => x"fe051ce3",
00000542 => x"00c12083",
00000543 => x"00812403",
00000544 => x"00412483",
00000545 => x"01010113",
00000546 => x"00008067",
00000547 => x"fe010113",
00000548 => x"00812c23",
00000549 => x"00912a23",
00000550 => x"01212823",
00000551 => x"00112e23",
00000552 => x"00b12623",
00000553 => x"00300413",
00000554 => x"00350493",
00000555 => x"fff00913",
00000556 => x"00c10793",
00000557 => x"008787b3",
00000558 => x"0007c583",
00000559 => x"40848533",
00000560 => x"fff40413",
00000561 => x"f65ff0ef",
00000562 => x"ff2414e3",
00000563 => x"01c12083",
00000564 => x"01812403",
00000565 => x"01412483",
00000566 => x"01012903",
00000567 => x"02010113",
00000568 => x"00008067",
00000569 => x"ff010113",
00000570 => x"00112623",
00000571 => x"00812423",
00000572 => x"00050413",
00000573 => x"cd1ff0ef",
00000574 => x"00000513",
00000575 => x"3fc000ef",
00000576 => x"0d800513",
00000577 => x"438000ef",
00000578 => x"00040513",
00000579 => x"ce1ff0ef",
00000580 => x"00000513",
00000581 => x"404000ef",
00000582 => x"c25ff0ef",
00000583 => x"00157513",
00000584 => x"fe051ce3",
00000585 => x"00c12083",
00000586 => x"00812403",
00000587 => x"01010113",
00000588 => x"00008067",
00000589 => x"fe010113",
00000590 => x"00112e23",
00000591 => x"00812c23",
00000592 => x"00912a23",
00000593 => x"01212823",
00000594 => x"01312623",
00000595 => x"01412423",
00000596 => x"01512223",
00000597 => x"34002473",
00000598 => x"02041863",
00000599 => x"ffff1537",
00000600 => x"ddc50513",
00000601 => x"01812403",
00000602 => x"01c12083",
00000603 => x"01412483",
00000604 => x"01012903",
00000605 => x"00c12983",
00000606 => x"00812a03",
00000607 => x"00412a83",
00000608 => x"02010113",
00000609 => x"2d00006f",
00000610 => x"ffff1537",
00000611 => x"e6450513",
00000612 => x"2c4000ef",
00000613 => x"00040513",
00000614 => x"a3dff0ef",
00000615 => x"ffff1537",
00000616 => x"e7050513",
00000617 => x"2b0000ef",
00000618 => x"00800537",
00000619 => x"a29ff0ef",
00000620 => x"ffff1537",
00000621 => x"e8c50513",
00000622 => x"29c000ef",
00000623 => x"288000ef",
00000624 => x"00050493",
00000625 => x"270000ef",
00000626 => x"07900793",
00000627 => x"0af49e63",
00000628 => x"bb1ff0ef",
00000629 => x"00051663",
00000630 => x"00300513",
00000631 => x"9a5ff0ef",
00000632 => x"ffff1537",
00000633 => x"e9850513",
00000634 => x"01045493",
00000635 => x"268000ef",
00000636 => x"00148493",
00000637 => x"00800937",
00000638 => x"fff00993",
00000639 => x"00010a37",
00000640 => x"fff48493",
00000641 => x"07349063",
00000642 => x"4788d5b7",
00000643 => x"afe58593",
00000644 => x"00800537",
00000645 => x"e79ff0ef",
00000646 => x"00800537",
00000647 => x"e79ff0ef",
00000648 => x"00800537",
00000649 => x"00040593",
00000650 => x"00450513",
00000651 => x"e69ff0ef",
00000652 => x"ff002a03",
00000653 => x"008009b7",
00000654 => x"ffc47413",
00000655 => x"00000493",
00000656 => x"00000913",
00000657 => x"00c98a93",
00000658 => x"01548533",
00000659 => x"009a07b3",
00000660 => x"02849663",
00000661 => x"00898513",
00000662 => x"412005b3",
00000663 => x"e39ff0ef",
00000664 => x"ffff1537",
00000665 => x"ecc50513",
00000666 => x"f05ff06f",
00000667 => x"00090513",
00000668 => x"e7dff0ef",
00000669 => x"01490933",
00000670 => x"f91ff06f",
00000671 => x"0007a583",
00000672 => x"00448493",
00000673 => x"00b90933",
00000674 => x"e0dff0ef",
00000675 => x"fbdff06f",
00000676 => x"01c12083",
00000677 => x"01812403",
00000678 => x"01412483",
00000679 => x"01012903",
00000680 => x"00c12983",
00000681 => x"00812a03",
00000682 => x"00412a83",
00000683 => x"02010113",
00000684 => x"00008067",
00000685 => x"000047b7",
00000686 => x"70078793",
00000687 => x"f8f02623",
00000688 => x"00008067",
00000689 => x"fe010113",
00000690 => x"00112e23",
00000691 => x"00812c23",
00000692 => x"00912a23",
00000693 => x"01212823",
00000694 => x"01312623",
00000695 => x"01412423",
00000696 => x"01512223",
00000697 => x"f1302973",
00000698 => x"00000a93",
00000699 => x"00900993",
00000700 => x"00300a13",
00000701 => x"00400493",
00000702 => x"41500433",
00000703 => x"00341413",
00000704 => x"01840413",
00000705 => x"00895433",
00000706 => x"0ff47413",
00000707 => x"00000513",
00000708 => x"0489ec63",
00000709 => x"00050863",
00000710 => x"03050513",
00000711 => x"0ff57513",
00000712 => x"12c000ef",
00000713 => x"03040513",
00000714 => x"0ff57513",
00000715 => x"120000ef",
00000716 => x"014a8663",
00000717 => x"02e00513",
00000718 => x"114000ef",
00000719 => x"001a8a93",
00000720 => x"fa9a9ce3",
00000721 => x"01c12083",
00000722 => x"01812403",
00000723 => x"01412483",
00000724 => x"01012903",
00000725 => x"00c12983",
00000726 => x"00812a03",
00000727 => x"00412a83",
00000728 => x"02010113",
00000729 => x"00008067",
00000730 => x"ff640413",
00000731 => x"00150513",
00000732 => x"0ff47413",
00000733 => x"0ff57513",
00000734 => x"f99ff06f",
00000735 => x"ff010113",
00000736 => x"f9402783",
00000737 => x"f9002703",
00000738 => x"f9402683",
00000739 => x"fed79ae3",
00000740 => x"00e12023",
00000741 => x"00f12223",
00000742 => x"00012503",
00000743 => x"00412583",
00000744 => x"01010113",
00000647 => x"00040593",
00000648 => x"00450513",
00000649 => x"e69ff0ef",
00000650 => x"ff002a03",
00000651 => x"008009b7",
00000652 => x"ffc47413",
00000653 => x"00000493",
00000654 => x"00000913",
00000655 => x"00c98a93",
00000656 => x"01548533",
00000657 => x"009a07b3",
00000658 => x"02849663",
00000659 => x"00898513",
00000660 => x"412005b3",
00000661 => x"e39ff0ef",
00000662 => x"ffff1537",
00000663 => x"e6050513",
00000664 => x"f05ff06f",
00000665 => x"00090513",
00000666 => x"e7dff0ef",
00000667 => x"01490933",
00000668 => x"f91ff06f",
00000669 => x"0007a583",
00000670 => x"00448493",
00000671 => x"00b90933",
00000672 => x"e0dff0ef",
00000673 => x"fbdff06f",
00000674 => x"01c12083",
00000675 => x"01812403",
00000676 => x"01412483",
00000677 => x"01012903",
00000678 => x"00c12983",
00000679 => x"00812a03",
00000680 => x"00412a83",
00000681 => x"02010113",
00000682 => x"00008067",
00000683 => x"fe010113",
00000684 => x"00112e23",
00000685 => x"00812c23",
00000686 => x"00912a23",
00000687 => x"01212823",
00000688 => x"01312623",
00000689 => x"01412423",
00000690 => x"01512223",
00000691 => x"f1302973",
00000692 => x"00000a93",
00000693 => x"00900993",
00000694 => x"00300a13",
00000695 => x"00400493",
00000696 => x"41500433",
00000697 => x"00341413",
00000698 => x"01840413",
00000699 => x"00895433",
00000700 => x"0ff47413",
00000701 => x"00000513",
00000702 => x"0489ec63",
00000703 => x"00050863",
00000704 => x"03050513",
00000705 => x"0ff57513",
00000706 => x"12c000ef",
00000707 => x"03040513",
00000708 => x"0ff57513",
00000709 => x"120000ef",
00000710 => x"014a8663",
00000711 => x"02e00513",
00000712 => x"114000ef",
00000713 => x"001a8a93",
00000714 => x"fa9a9ce3",
00000715 => x"01c12083",
00000716 => x"01812403",
00000717 => x"01412483",
00000718 => x"01012903",
00000719 => x"00c12983",
00000720 => x"00812a03",
00000721 => x"00412a83",
00000722 => x"02010113",
00000723 => x"00008067",
00000724 => x"ff640413",
00000725 => x"00150513",
00000726 => x"0ff47413",
00000727 => x"0ff57513",
00000728 => x"f99ff06f",
00000729 => x"ff010113",
00000730 => x"f9402783",
00000731 => x"f9002703",
00000732 => x"f9402683",
00000733 => x"fed79ae3",
00000734 => x"00e12023",
00000735 => x"00f12223",
00000736 => x"00012503",
00000737 => x"00412583",
00000738 => x"01010113",
00000739 => x"00008067",
00000740 => x"f9800693",
00000741 => x"fff00613",
00000742 => x"00c6a023",
00000743 => x"00a6a023",
00000744 => x"00b6a223",
00000745 => x"00008067",
00000746 => x"f9800693",
00000747 => x"fff00613",
00000748 => x"00c6a023",
00000749 => x"00a6a023",
00000750 => x"00b6a223",
00000751 => x"00008067",
00000752 => x"fa002023",
00000753 => x"fe002683",
00000754 => x"00151513",
00000755 => x"00000713",
00000756 => x"04a6f263",
00000757 => x"000016b7",
00000758 => x"00000793",
00000759 => x"ffe68693",
00000760 => x"04e6e463",
00000761 => x"00167613",
00000762 => x"0015f593",
00000763 => x"01879793",
00000764 => x"01e61613",
00000765 => x"00c7e7b3",
00000766 => x"01d59593",
00000767 => x"00b7e7b3",
00000768 => x"00e7e7b3",
00000769 => x"10000737",
00000770 => x"00e7e7b3",
00000771 => x"faf02023",
00000772 => x"00008067",
00000773 => x"00170793",
00000774 => x"01079713",
00000775 => x"40a686b3",
00000776 => x"01075713",
00000777 => x"fadff06f",
00000778 => x"ffe78513",
00000779 => x"0fd57513",
00000780 => x"00051a63",
00000781 => x"00375713",
00000782 => x"00178793",
00000783 => x"0ff7f793",
00000784 => x"fa1ff06f",
00000785 => x"00175713",
00000786 => x"ff1ff06f",
00000787 => x"fa002783",
00000788 => x"fe07cee3",
00000789 => x"faa02223",
00000790 => x"00008067",
00000791 => x"fa402503",
00000792 => x"fe055ee3",
00000793 => x"0ff57513",
00000794 => x"00008067",
00000795 => x"ff010113",
00000796 => x"00812423",
00000797 => x"01212023",
00000798 => x"00112623",
00000799 => x"00912223",
00000800 => x"00050413",
00000801 => x"00a00913",
00000802 => x"00044483",
00000803 => x"00140413",
00000804 => x"00049e63",
00000805 => x"00c12083",
00000806 => x"00812403",
00000807 => x"00412483",
00000808 => x"00012903",
00000809 => x"01010113",
00000810 => x"00008067",
00000811 => x"01249663",
00000812 => x"00d00513",
00000813 => x"f99ff0ef",
00000814 => x"00048513",
00000815 => x"f91ff0ef",
00000816 => x"fc9ff06f",
00000817 => x"00757513",
00000818 => x"00177793",
00000819 => x"01079793",
00000820 => x"0036f693",
00000821 => x"00a51513",
00000822 => x"00f56533",
00000823 => x"00167613",
00000824 => x"00e69793",
00000825 => x"0015f593",
00000826 => x"00f567b3",
00000827 => x"00d61613",
00000828 => x"00c7e7b3",
00000829 => x"00959593",
00000830 => x"fa800813",
00000831 => x"00b7e7b3",
00000832 => x"00082023",
00000833 => x"1007e793",
00000834 => x"00f82023",
00000835 => x"00008067",
00000836 => x"fa800713",
00000837 => x"00072783",
00000838 => x"eff7f793",
00000839 => x"00f72023",
00000840 => x"00008067",
00000841 => x"fa800713",
00000842 => x"00072683",
00000843 => x"00757793",
00000844 => x"00100513",
00000845 => x"00f51533",
00000846 => x"00d56533",
00000847 => x"00a72023",
00000848 => x"00008067",
00000849 => x"fa800713",
00000850 => x"00072683",
00000851 => x"00757513",
00000852 => x"00100793",
00000853 => x"00a797b3",
00000854 => x"fff7c793",
00000855 => x"00d7f7b3",
00000856 => x"00f72023",
00000857 => x"00008067",
00000858 => x"faa02623",
00000859 => x"fa802783",
00000860 => x"fe07cee3",
00000861 => x"fac02503",
00000862 => x"00008067",
00000863 => x"f8400713",
00000864 => x"00072683",
00000865 => x"00f57793",
00000866 => x"00100513",
00000867 => x"00f51533",
00000868 => x"00d54533",
00000869 => x"00a72023",
00000870 => x"00008067",
00000871 => x"f8a02223",
00000872 => x"00008067",
00000873 => x"fb800713",
00000874 => x"00072783",
00000875 => x"ffe7f793",
00000876 => x"00f72023",
00000877 => x"00008067",
00000878 => x"fb000713",
00000879 => x"00072783",
00000880 => x"ff77f793",
00000881 => x"00f72023",
00000882 => x"00008067",
00000883 => x"fc000713",
00000884 => x"00072783",
00000885 => x"00179793",
00000886 => x"0017d793",
00000887 => x"00f72023",
00000888 => x"00008067",
00000889 => x"69617641",
00000890 => x"6c62616c",
00000891 => x"4d432065",
00000892 => x"0a3a7344",
00000893 => x"203a6820",
00000894 => x"706c6548",
00000895 => x"3a72200a",
00000896 => x"73655220",
00000897 => x"74726174",
00000898 => x"3a75200a",
00000899 => x"6c705520",
00000900 => x"0a64616f",
00000901 => x"203a7320",
00000902 => x"726f7453",
00000903 => x"6f742065",
00000904 => x"616c6620",
00000905 => x"200a6873",
00000906 => x"4c203a6c",
00000907 => x"2064616f",
00000908 => x"6d6f7266",
00000909 => x"616c6620",
00000910 => x"200a6873",
00000911 => x"45203a65",
00000912 => x"75636578",
00000913 => x"00006574",
00000914 => x"65206f4e",
00000915 => x"75636578",
00000916 => x"6c626174",
00000917 => x"76612065",
00000918 => x"616c6961",
00000919 => x"2e656c62",
00000920 => x"00000000",
00000921 => x"746f6f42",
00000922 => x"2e676e69",
00000923 => x"0a0a2e2e",
00000924 => x"00000000",
00000925 => x"52450a07",
00000926 => x"00005f52",
00000927 => x"6e6b6e75",
00000928 => x"006e776f",
00000929 => x"00007830",
00000930 => x"58450a0a",
00000931 => x"54504543",
00000932 => x"3a4e4f49",
00000933 => x"00000020",
00000934 => x"30204020",
00000935 => x"00000078",
00000936 => x"69617741",
00000937 => x"676e6974",
00000938 => x"6f656e20",
00000939 => x"32337672",
00000940 => x"6578655f",
00000941 => x"6e69622e",
00000942 => x"202e2e2e",
00000943 => x"00000000",
00000944 => x"64616f4c",
00000945 => x"2e676e69",
00000946 => x"00202e2e",
00000947 => x"00004b4f",
00000948 => x"74697257",
00000949 => x"78302065",
00000950 => x"00000000",
00000951 => x"74796220",
00000952 => x"74207365",
00000953 => x"5053206f",
00000954 => x"6c662049",
00000955 => x"20687361",
00000956 => x"78302040",
00000957 => x"00000000",
00000958 => x"7928203f",
00000959 => x"20296e2f",
00000960 => x"00000000",
00000961 => x"616c460a",
00000962 => x"6e696873",
00000963 => x"2e2e2e67",
00000964 => x"00000020",
00000965 => x"0a0a0a0a",
00000966 => x"4e203c3c",
00000967 => x"56524f45",
00000968 => x"42203233",
00000969 => x"6c746f6f",
00000970 => x"6564616f",
00000971 => x"3e3e2072",
00000972 => x"4c420a0a",
00000973 => x"203a5644",
00000974 => x"20677541",
00000975 => x"32203620",
00000976 => x"0a303230",
00000977 => x"3a565748",
00000978 => x"00002020",
00000979 => x"4b4c430a",
00000980 => x"0020203a",
00000981 => x"0a7a4820",
00000982 => x"52455355",
00000983 => x"0000203a",
00000984 => x"53494d0a",
00000985 => x"00203a41",
00000986 => x"4e4f430a",
00000987 => x"00203a46",
00000988 => x"454d490a",
00000989 => x"00203a4d",
00000990 => x"74796220",
00000991 => x"40207365",
00000992 => x"00000020",
00000993 => x"454d440a",
00000994 => x"00203a4d",
00000995 => x"75410a0a",
00000996 => x"6f626f74",
00000997 => x"6920746f",
00000998 => x"7338206e",
00000999 => x"7250202e",
00001000 => x"20737365",
00001001 => x"2079656b",
00001002 => x"61206f74",
00001003 => x"74726f62",
00001004 => x"00000a2e",
00001005 => x"0000000a",
00001006 => x"726f6241",
00001007 => x"2e646574",
00001008 => x"00000a0a",
00001009 => x"444d430a",
00001010 => x"00203e3a",
00001011 => x"53207962",
00001012 => x"68706574",
00001013 => x"4e206e61",
00001014 => x"69746c6f",
00001015 => x"0000676e",
00001016 => x"61766e49",
00001017 => x"2064696c",
00001018 => x"00444d43",
00001019 => x"33323130",
00001020 => x"37363534",
00001021 => x"42413938",
00001022 => x"46454443",
00000746 => x"fa002023",
00000747 => x"fe002683",
00000748 => x"00151513",
00000749 => x"00000713",
00000750 => x"04a6f263",
00000751 => x"000016b7",
00000752 => x"00000793",
00000753 => x"ffe68693",
00000754 => x"04e6e463",
00000755 => x"00167613",
00000756 => x"0015f593",
00000757 => x"01879793",
00000758 => x"01e61613",
00000759 => x"00c7e7b3",
00000760 => x"01d59593",
00000761 => x"00b7e7b3",
00000762 => x"00e7e7b3",
00000763 => x"10000737",
00000764 => x"00e7e7b3",
00000765 => x"faf02023",
00000766 => x"00008067",
00000767 => x"00170793",
00000768 => x"01079713",
00000769 => x"40a686b3",
00000770 => x"01075713",
00000771 => x"fadff06f",
00000772 => x"ffe78513",
00000773 => x"0fd57513",
00000774 => x"00051a63",
00000775 => x"00375713",
00000776 => x"00178793",
00000777 => x"0ff7f793",
00000778 => x"fa1ff06f",
00000779 => x"00175713",
00000780 => x"ff1ff06f",
00000781 => x"fa002783",
00000782 => x"fe07cee3",
00000783 => x"faa02223",
00000784 => x"00008067",
00000785 => x"fa402503",
00000786 => x"fe055ee3",
00000787 => x"0ff57513",
00000788 => x"00008067",
00000789 => x"ff010113",
00000790 => x"00812423",
00000791 => x"01212023",
00000792 => x"00112623",
00000793 => x"00912223",
00000794 => x"00050413",
00000795 => x"00a00913",
00000796 => x"00044483",
00000797 => x"00140413",
00000798 => x"00049e63",
00000799 => x"00c12083",
00000800 => x"00812403",
00000801 => x"00412483",
00000802 => x"00012903",
00000803 => x"01010113",
00000804 => x"00008067",
00000805 => x"01249663",
00000806 => x"00d00513",
00000807 => x"f99ff0ef",
00000808 => x"00048513",
00000809 => x"f91ff0ef",
00000810 => x"fc9ff06f",
00000811 => x"00757513",
00000812 => x"00177793",
00000813 => x"01079793",
00000814 => x"0036f693",
00000815 => x"00a51513",
00000816 => x"00f56533",
00000817 => x"00167613",
00000818 => x"00e69793",
00000819 => x"0015f593",
00000820 => x"00f567b3",
00000821 => x"00d61613",
00000822 => x"00c7e7b3",
00000823 => x"00959593",
00000824 => x"fa800813",
00000825 => x"00b7e7b3",
00000826 => x"00082023",
00000827 => x"1007e793",
00000828 => x"00f82023",
00000829 => x"00008067",
00000830 => x"fa800713",
00000831 => x"00072683",
00000832 => x"00757793",
00000833 => x"00100513",
00000834 => x"00f51533",
00000835 => x"00d56533",
00000836 => x"00a72023",
00000837 => x"00008067",
00000838 => x"fa800713",
00000839 => x"00072683",
00000840 => x"00757513",
00000841 => x"00100793",
00000842 => x"00a797b3",
00000843 => x"fff7c793",
00000844 => x"00d7f7b3",
00000845 => x"00f72023",
00000846 => x"00008067",
00000847 => x"faa02623",
00000848 => x"fa802783",
00000849 => x"fe07cee3",
00000850 => x"fac02503",
00000851 => x"00008067",
00000852 => x"f8400713",
00000853 => x"00072683",
00000854 => x"00f57793",
00000855 => x"00100513",
00000856 => x"00f51533",
00000857 => x"00d54533",
00000858 => x"00a72023",
00000859 => x"00008067",
00000860 => x"f8a02223",
00000861 => x"00008067",
00000862 => x"69617641",
00000863 => x"6c62616c",
00000864 => x"4d432065",
00000865 => x"0a3a7344",
00000866 => x"203a6820",
00000867 => x"706c6548",
00000868 => x"3a72200a",
00000869 => x"73655220",
00000870 => x"74726174",
00000871 => x"3a75200a",
00000872 => x"6c705520",
00000873 => x"0a64616f",
00000874 => x"203a7320",
00000875 => x"726f7453",
00000876 => x"6f742065",
00000877 => x"616c6620",
00000878 => x"200a6873",
00000879 => x"4c203a6c",
00000880 => x"2064616f",
00000881 => x"6d6f7266",
00000882 => x"616c6620",
00000883 => x"200a6873",
00000884 => x"45203a65",
00000885 => x"75636578",
00000886 => x"00006574",
00000887 => x"65206f4e",
00000888 => x"75636578",
00000889 => x"6c626174",
00000890 => x"76612065",
00000891 => x"616c6961",
00000892 => x"2e656c62",
00000893 => x"00000000",
00000894 => x"746f6f42",
00000895 => x"2e676e69",
00000896 => x"0a0a2e2e",
00000897 => x"00000000",
00000898 => x"52450a07",
00000899 => x"00005f52",
00000900 => x"6e6b6e75",
00000901 => x"006e776f",
00000902 => x"00007830",
00000903 => x"58450a0a",
00000904 => x"54504543",
00000905 => x"3a4e4f49",
00000906 => x"00000020",
00000907 => x"30204020",
00000908 => x"00000078",
00000909 => x"69617741",
00000910 => x"676e6974",
00000911 => x"6f656e20",
00000912 => x"32337672",
00000913 => x"6578655f",
00000914 => x"6e69622e",
00000915 => x"202e2e2e",
00000916 => x"00000000",
00000917 => x"64616f4c",
00000918 => x"2e676e69",
00000919 => x"00202e2e",
00000920 => x"00004b4f",
00000921 => x"74697257",
00000922 => x"78302065",
00000923 => x"00000000",
00000924 => x"74796220",
00000925 => x"74207365",
00000926 => x"5053206f",
00000927 => x"6c662049",
00000928 => x"20687361",
00000929 => x"78302040",
00000930 => x"00000000",
00000931 => x"7928203f",
00000932 => x"20296e2f",
00000933 => x"00000000",
00000934 => x"616c460a",
00000935 => x"6e696873",
00000936 => x"2e2e2e67",
00000937 => x"00000020",
00000938 => x"0a0a0a0a",
00000939 => x"4e203c3c",
00000940 => x"56524f45",
00000941 => x"42203233",
00000942 => x"6c746f6f",
00000943 => x"6564616f",
00000944 => x"3e3e2072",
00000945 => x"4c420a0a",
00000946 => x"203a5644",
00000947 => x"20677541",
00000948 => x"32203032",
00000949 => x"0a303230",
00000950 => x"3a565748",
00000951 => x"00002020",
00000952 => x"4b4c430a",
00000953 => x"0020203a",
00000954 => x"0a7a4820",
00000955 => x"52455355",
00000956 => x"0000203a",
00000957 => x"53494d0a",
00000958 => x"00203a41",
00000959 => x"4e4f430a",
00000960 => x"00203a46",
00000961 => x"454d490a",
00000962 => x"00203a4d",
00000963 => x"74796220",
00000964 => x"40207365",
00000965 => x"00000020",
00000966 => x"454d440a",
00000967 => x"00203a4d",
00000968 => x"75410a0a",
00000969 => x"6f626f74",
00000970 => x"6920746f",
00000971 => x"7338206e",
00000972 => x"7250202e",
00000973 => x"20737365",
00000974 => x"2079656b",
00000975 => x"61206f74",
00000976 => x"74726f62",
00000977 => x"00000a2e",
00000978 => x"0000000a",
00000979 => x"726f6241",
00000980 => x"2e646574",
00000981 => x"00000a0a",
00000982 => x"444d430a",
00000983 => x"00203e3a",
00000984 => x"53207962",
00000985 => x"68706574",
00000986 => x"4e206e61",
00000987 => x"69746c6f",
00000988 => x"0000676e",
00000989 => x"61766e49",
00000990 => x"2064696c",
00000991 => x"00444d43",
00000992 => x"33323130",
00000993 => x"37363534",
00000994 => x"42413938",
00000995 => x"46454443",
others => x"00000000"
);
 
/rtl/core/neorv32_cpu_control.vhd
674,13 → 674,13
trap_ctrl.instr_ma <= ipb.rdata(33); -- misaligned instruction fetch address
trap_ctrl.instr_be <= ipb.rdata(34); -- bus access fault during instrucion fetch
illegal_compressed <= ipb.rdata(35); -- invalid decompressed instruction
execute_engine.is_ci_nxt <= ipb.rdata(32); -- flag to indicate this is a compressed instruction beeing executed
execute_engine.i_reg_nxt <= ipb.rdata(31 downto 0);
execute_engine.if_rst_nxt <= '0';
if (execute_engine.if_rst = '0') then -- if there was no non-linear PC modification
execute_engine.pc_nxt <= execute_engine.next_pc;
end if;
-- ipb.rdata(35) (invalid decompressed instruction) is not immediately checked here!
execute_engine.is_ci_nxt <= ipb.rdata(32); -- flag to indicate this is a compressed instruction beeing executed
execute_engine.i_reg_nxt <= ipb.rdata(31 downto 0);
execute_engine.if_rst_nxt <= '0';
if (execute_engine.if_rst = '0') then -- if there was no non-linear PC modification
execute_engine.pc_nxt <= execute_engine.next_pc;
end if;
--
if (execute_engine.sleep = '1') or (trap_ctrl.env_start = '1') or ((ipb.rdata(33) or ipb.rdata(34)) = '1') then
execute_engine.state_nxt <= TRAP;
else
/rtl/core/neorv32_package.vhd
41,7 → 41,7
-- Architecture Constants -----------------------------------------------------------------
-- -------------------------------------------------------------------------------------------
constant data_width_c : natural := 32; -- data width - FIXED!
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01030700"; -- no touchy!
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01030702"; -- no touchy!
constant pmp_max_r_c : natural := 8; -- max PMP regions
constant ipb_entries_c : natural := 2; -- entries in instruction prefetch buffer, power of 2
 
/sw/bootloader/bootloader.c
168,19 → 168,9
 
// ------------------------------------------------
// Processor hardware initialization
// - all IO devices are reset and disbaled by the crt0 code
// ------------------------------------------------
 
// reset system time
MTIME_LO = 0;
MTIME_HI = 0;
 
// deactivate unused IO devices
neorv32_wdt_disable();
neorv32_pwm_disable();
neorv32_spi_disable();
neorv32_trng_disable();
neorv32_twi_disable();
 
// get clock speed (in Hz)
uint32_t clock_speed = SYSINFO_CLK;
 
/sw/bootloader/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/common/bootloader_neorv32.ld
1,5 → 1,5
/* ################################################################################################# */
/* # << NEORV32 - RISC-V GCC Linker Script (for bootloader) >> # */
/* # << NEORV32 - RISC-V GCC Linker Script (for bootloader only) >> # */
/* # ********************************************************************************************* # */
/* # BSD 3-Clause License # */
/* # # */
99,9 → 99,10
 
*(.rela.plt)
 
KEEP(*(.text.boot)); /* keep start-up code */
 
KEEP (*(SORT_NONE(.init)))
 
KEEP(bootloader_crt0.elf(.text)); /* NEORV32-SPECIFIC bootloader start-up code */
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
/sw/common/crt0.S
1,10 → 1,6
/* ################################################################################################# */
/* # << NEORV32 - crt0.S - Application Start-Up Code & Minimal Runtime Environment >> # */
/* # << NEORV32 - crt0.S - Start-Up Code >> # */
/* # ********************************************************************************************* # */
/* # The start-up code provides a minimal runtime environment that catches all exceptions and # */
/* # interrupts and delegates them to the handler functions (installed by user via dedicated # */
/* # install function from the neorv32 runtime environment library). # */
/* # ********************************************************************************************* # */
/* # BSD 3-Clause License # */
/* # # */
/* # Copyright (c) 2020, Stephan Nolting. All rights reserved. # */
36,26 → 32,27
/* # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting # */
/* ################################################################################################# */
 
.file "crt0.S"
.section .text
.balign 4
.global _start
.file "crt0.S"
.section .text.boot
.balign 4
.global _start
 
 
// IO region
.equ IO_BEGIN, 0xFFFFFF80 // start of processor-internal IO region
// IO region
.equ IO_BEGIN, 0xFFFFFF80 // start of processor-internal IO region
 
// SYSINFO
.equ SYSINFO_DSPACE_BASE, 0xFFFFFFF4
.equ SYSINFO_DSPACE_SIZE, 0xFFFFFFFC
// SYSINFO
.equ SYSINFO_DSPACE_BASE, 0xFFFFFFF4
.equ SYSINFO_DSPACE_SIZE, 0xFFFFFFFC
 
 
_start:
.cfi_startproc
.cfi_undefined ra
.cfi_startproc
.cfi_undefined ra
 
// *********************************************************
// Clear register file
// Assume 'worst case': rv32e
// *********************************************************
__crt0_reg_file_clear:
//addi x0, x0, 0 // hardwired to zero
71,22 → 68,12
//addi x10, x0, 0
//addi x11, x0, 0
//addi x12, x0, 0
//addi x13, x0, 0
//addi x14, x0, 0
addi x13, x0, 0
addi x14, x0, 0
addi x15, x0, 0
 
// since we dont know here if we are compiling for a rv32e architecture
// we won't touch registers above x15
 
 
// *********************************************************
// TEST AREA / DANGER ZONE
// *********************************************************
__crt0_tests:
nop
 
 
// *********************************************************
// Setup stack pointer
// *********************************************************
__crt0_stack_pointer_init:
100,11 → 87,13
// *********************************************************
// Setup global pointer
// *********************************************************
#ifndef __BOOTLOADER_START_CODE__
__crt0_global_pointer_init:
.option push
.option norelax
.option push
.option norelax
la gp, __global_pointer$
.option pop
.option pop
#endif
 
 
// *********************************************************
120,6 → 109,7
// Devices, that are not implemented, will cause a store access fault
// which is captured but actually ignored due to the dummy handler.
// *********************************************************
#ifndef __BOOTLOADER_START_CODE__
__crt0_reset_io:
li x11, IO_BEGIN // start of processor-internal IO region
 
127,11 → 117,13
sw zero, 0(x11)
addi x11, x11, 4
bne zero, x11, __crt0_reset_io_loop
#endif
 
 
// *********************************************************
// Clear .bss section (byte-wise)
// *********************************************************
#ifndef __BOOTLOADER_START_CODE__
__crt0_clear_bss:
la x11, __crt0_bss_start
la x12, __crt0_bss_end
143,11 → 135,13
j __crt0_clear_bss_loop
 
__crt0_clear_bss_loop_end:
#endif
 
 
// *********************************************************
// Copy initialized .data section from ROM to RAM (byte-wise)
// *********************************************************
#ifndef __BOOTLOADER_START_CODE__
__crt0_copy_data:
la x11, __crt0_copy_data_src_begin // start of data area (copy source)
la x12, __crt0_copy_data_dst_begin // start of data area (copy destination)
162,6 → 156,7
j __crt0_copy_data_loop
 
__crt0_copy_data_loop_end:
#endif
 
 
// *********************************************************
181,8 → 176,7
__crt0_this_is_the_end:
csrrci zero, mstatus, 8 // mstatus: disable global IRQs (MIE)
wfi
__crt0_this_is_the_end_end:
j __crt0_this_is_the_end_end // in case Ziscr is not available
j . // in case WFI is not available
 
 
// *********************************************************
189,8 → 183,8
// dummy trap handler (for exceptions & IRQs)
// tries to move on to next instruction
// *********************************************************
.global __crt0_dummy_trap_handler
.balign 4
.global __crt0_dummy_trap_handler
.balign 4
__crt0_dummy_trap_handler:
 
addi sp, sp, -8
200,7 → 194,6
csrr x8, mcause
blt x8, zero, __crt0_dummy_trap_handler_irq // skip mepc modification if interrupt
 
__crt0_dummy_trap_handler_compute_return:
csrr x8, mepc
 
// is compressed instruction?
226,5 → 219,5
 
mret
 
.cfi_endproc
.end
.cfi_endproc
.end
/sw/common/neorv32.ld
103,9 → 103,10
 
*(.rela.plt)
 
KEEP(*(.text.boot)); /* keep start-up code */
 
KEEP (*(SORT_NONE(.init)))
 
KEEP(crt0.elf(.text)); /* NEORV32-SPECIFIC start-up code */
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
212,7 → 213,7
/* zero/non-initialized read/write data placed in RAM */
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.bss :
.bss (NOLOAD):
{
__bss_start = .;
*(.dynsbss)
/sw/example/blink_led/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/coremark/core_main.c
97,7 → 97,12
// -----------------------------------------------
// Disable coremark compilation by default
#ifndef RUN_COREMARK
#warning COREMARK HAS NOT BEEN COMPILED! Use >>make clean compile USER_FLAGS+=-DRUN_COREMARK<< to compile it.
#warning COREMARK HAS NOT BEEN COMPILED! Use >>make USER_FLAGS+=-DRUN_COREMARK clean_all compile<< to compile it.
 
// inform the user if you are actually executing this
portable_init(NULL, &argc, argv);
ee_printf("ERROR! CoreMark has not been compiled. Use >>make USER_FLAGS+=-DRUN_COREMARK clean_all compile<< to compile it.\n");
 
return 0;
#endif
// -----------------------------------------------
/sw/example/coremark/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/cpu_test/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/demo_pwm/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/demo_trng/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/demo_twi/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/demo_wdt/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/game_of_life/makefile
36,17 → 36,19
 
 
# *****************************************************************************
# USER CONFIGURATION (use default if not set by user)
# USER CONFIGURATION
# *****************************************************************************
# Compiler effort
EFFORT ?= -Os
# User's application sources (*.c, *.cpp, *.s, *.S); add additional files here
APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S)
 
# User's application sources (add additional files here)
APP_SRC ?= $(wildcard *.c)
 
# User's application include folders (don't forget the '-I' before each entry)
APP_INC ?= -I .
# User's application include folders - for assembly files only (don't forget the '-I' before each entry)
ASM_INC ?= -I .
 
# Optimization
EFFORT ?= -Os
 
# Compiler toolchain
RISCV_TOOLCHAIN ?= riscv32-unknown-elf
 
54,6 → 56,9
MARCH ?= -march=rv32i
MABI ?= -mabi=ilp32
 
# User flags for additional configuration (will be added to compiler flags)
USER_FLAGS ?=
 
# Relative or absolute path to the NEORV32 home folder
NEORV32_HOME ?= ../../..
# *****************************************************************************
64,74 → 69,85
# NEORV32 framework
# -----------------------------------------------------------------------------
# Path to NEORV32 linker script and startup file
NEORV32_COM_PATH=$(NEORV32_HOME)/sw/common
NEORV32_COM_PATH = $(NEORV32_HOME)/sw/common
# Path to main NEORV32 library include files
NEORV32_INC_PATH=$(NEORV32_HOME)/sw/lib/include
NEORV32_INC_PATH = $(NEORV32_HOME)/sw/lib/include
# Path to main NEORV32 library source files
NEORV32_SRC_PATH=$(NEORV32_HOME)/sw/lib/source
NEORV32_SRC_PATH = $(NEORV32_HOME)/sw/lib/source
# Path to NEORV32 executable generator
NEORV32_EXG_PATH=$(NEORV32_HOME)/sw/image_gen
NEORV32_EXG_PATH = $(NEORV32_HOME)/sw/image_gen
# Path to NEORV32 core rtl folder
NEORV32_RTL_PATH=$(NEORV32_HOME)/rtl/core
# Marker file to verify NEORV32 home folder
NEORV32_HOME_MARKER=$(NEORV32_INC_PATH)/neorv32.h
NEORV32_RTL_PATH = $(NEORV32_HOME)/rtl/core
# Marker file to check for NEORV32 home folder
NEORV32_HOME_MARKER = $(NEORV32_INC_PATH)/neorv32.h
 
# Core libraries (peripheral and CPU drivers)
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Application start-up code
CORE_SRC += $(NEORV32_COM_PATH)/crt0.S
 
# -----------------------------------------------------------------------------
# NEORV32 core sources
# -----------------------------------------------------------------------------
CORE_SRC = $(wildcard $(NEORV32_SRC_PATH)/*.c)
# Default linker script
LD_SCRIPT = $(NEORV32_COM_PATH)/neorv32.ld
 
# Main output files
APP_EXE = neorv32_exe.bin
APP_ASM = main.asm
APP_IMG = neorv32_application_image.vhd
BOOT_IMG = neorv32_bootloader_image.vhd
 
# -----------------------------------------------------------------------------
# Make defaults
# -----------------------------------------------------------------------------
.DEFAULT_GOAL := help
 
 
# -----------------------------------------------------------------------------
# Application output definitions
# Sources and objects
# -----------------------------------------------------------------------------
APP_EXE = neorv32_exe.bin
APP_ASM = main.s
# Define all sources
SRC = $(APP_SRC)
SRC += $(CORE_SRC)
 
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) neorv32_application_image.vhd
all: $(APP_ASM) $(APP_EXE) neorv32_application_image.vhd
# Define all object files
OBJ = $(SRC:%=%.o)
 
# define all object files
OBJ = $(APP_SRC:.c=.o)
OBJ += $(CORE_SRC:.c=.o)
 
 
# -----------------------------------------------------------------------------
# Tools and flags
# -----------------------------------------------------------------------------
# compiler tools
# Compiler tools
CC = $(RISCV_TOOLCHAIN)-gcc
OBJDUMP = $(RISCV_TOOLCHAIN)-objdump
OBJCOPY = $(RISCV_TOOLCHAIN)-objcopy
SIZE = $(RISCV_TOOLCHAIN)-size
 
# Host native compiler
CC_X86 = gcc -Wall -O -g
 
# NEORV32 executable image generator
IMAGE_GEN = $(NEORV32_EXG_PATH)/image_gen
 
# Compiler & linker flags
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS = $(MARCH) $(MABI) $(EFFORT) -Wall -ffunction-sections -fdata-sections -nostartfiles
CC_OPTS += -Wl,--gc-sections -lm -lc -lgcc -lc
 
# User flags for additional configuration
USER_FLAGS =
CC_OPTS += $(USER_FLAGS)
 
 
# -----------------------------------------------------------------------------
# Host native compiler
# Application output definitions
# -----------------------------------------------------------------------------
CC_X86 = gcc -Wall -O -g
.PHONY: check info help elf_info clean clean_all bootloader
.DEFAULT_GOAL := help
 
# 'compile' is still here for compatibility
exe: $(APP_ASM) $(APP_EXE)
compile: $(APP_ASM) $(APP_EXE)
install: $(APP_ASM) $(APP_IMG)
all: $(APP_ASM) $(APP_EXE) $(APP_IMG)
 
# Check if making bootloader
# This will disable some functions in crt0.S that are not relevant for the bootloader
target bootloader: USER_FLAGS += -D__BOOTLOADER_START_CODE__
target bootloader: LD_SCRIPT = $(NEORV32_COM_PATH)/bootloader_neorv32.ld
 
 
# -----------------------------------------------------------------------------
# Tool targets
# Image generator targets
# -----------------------------------------------------------------------------
# install/compile tools
$(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.cpp
140,19 → 156,27
 
 
# -----------------------------------------------------------------------------
# Application targets: Assemble, compile, link, dump
# General targets: Assemble, compile, link, dump
# -----------------------------------------------------------------------------
# Assemble startup code
crt0.elf: $(NEORV32_COM_PATH)/crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
# Compile app *.s sources (assembly)
%.s.o: %.s
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app sources
$(OBJ): %.o : %.c crt0.elf
# Compile app *.S sources (assembly + C pre-processor)
%.S.o: %.S
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(ASM_INC) $< -o $@
 
# Compile app *.c sources
%.c.o: %.c
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Compile app *.cpp sources
%.cpp.o: %.cpp
@$(CC) -c $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) $< -o $@
 
# Link object files and show memory utilization
main.elf: $(OBJ)
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/neorv32.ld $(OBJ) -o $@
@$(CC) $(CC_OPTS) -T $(LD_SCRIPT) $(OBJ) -o $@
@echo "Memory utilization:"
@$(SIZE) main.elf
 
160,12 → 184,8
$(APP_ASM): main.elf
@$(OBJDUMP) -D -S -z $< > $@
 
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate final executable: text, rodata, data (in THIS order!)
main.bin: main.elf
# Generate final executable from .text + .rodata + .data (in THIS order!)
main.bin: main.elf $(APP_ASM)
@$(OBJCOPY) -I elf32-little $< -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little $< -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little $< -j .data -O binary data.bin
172,7 → 192,11
@cat text.bin rodata.bin data.bin > $@
@rm -f text.bin rodata.bin data.bin
 
# Generate NEORV32 executable image for bootloader update
 
# -----------------------------------------------------------------------------
# Application targets: Generate binary executable, install (as VHDL file)
# -----------------------------------------------------------------------------
# Generate NEORV32 executable image for upload via bootloader
$(APP_EXE): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_bin $< $@ $(shell basename $(CURDIR))
180,38 → 204,27
@wc -c < $(APP_EXE)
 
# Generate NEORV32 executable VHDL boot image
neorv32_application_image.vhd: main.bin $(IMAGE_GEN)
$(APP_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@echo "Installing application image to $(NEORV32_RTL_PATH)/neorv32_application_image.vhd"
@cp neorv32_application_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_application_image.vhd
@echo "Installing application image to $(NEORV32_RTL_PATH)/$(APP_IMG)"
@cp $(APP_IMG) $(NEORV32_RTL_PATH)/.
 
 
# -----------------------------------------------------------------------------
# Bootloader targets
# -----------------------------------------------------------------------------
# Assemble startup code
bootloader_crt0.elf: $(NEORV32_COM_PATH)/bootloader_crt0.S
@$(CC) $(CC_OPTS) -c $< -o $@
 
# Compile and install bootloader
bootloader: bootloader_crt0.elf $(OBJ) $(IMAGE_GEN)
# Create and install bootloader VHDL init image
$(BOOT_IMG): main.bin $(IMAGE_GEN)
@set -e
@$(CC) $(CC_OPTS) -I $(NEORV32_INC_PATH) $(APP_INC) -T $(NEORV32_COM_PATH)/bootloader_neorv32.ld $(OBJ) -o bootloader.elf
@echo "Memory utilization:"
@$(SIZE) bootloader.elf
@$(OBJDUMP) -D -S -z bootloader.elf > bootloader.s
@$(OBJCOPY) -I elf32-little bootloader.elf -j .text -O binary text.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .rodata -O binary rodata.bin
@$(OBJCOPY) -I elf32-little bootloader.elf -j .data -O binary data.bin
@cat text.bin rodata.bin data.bin > bootloader.bin
@$(IMAGE_GEN) -bld_img bootloader.bin neorv32_bootloader_image.vhd $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/neorv32_bootloader_image.vhd"
@cp neorv32_bootloader_image.vhd $(NEORV32_RTL_PATH)/.
@rm -f neorv32_bootloader_image.vhd text.bin rodata.bin data.bin
@$(IMAGE_GEN) -bld_img $< $(BOOT_IMG) $(shell basename $(CURDIR))
@echo "Installing bootloader image to $(NEORV32_RTL_PATH)/$(BOOT_IMG)"
@cp $(BOOT_IMG) $(NEORV32_RTL_PATH)/.
 
# Just an alias that
bootloader: $(BOOT_IMG)
 
 
# -----------------------------------------------------------------------------
# Check toolchain
# -----------------------------------------------------------------------------
242,36 → 255,40
# -----------------------------------------------------------------------------
info:
@echo "---------------- Info: Project ----------------"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "Project folder: $(shell basename $(CURDIR))"
@echo "Source files: $(APP_SRC)"
@echo "Include folder(s): $(APP_INC)"
@echo "ASM include folder(s): $(ASM_INC)"
@echo "---------------- Info: NEORV32 ----------------"
@echo "NEORV32 home folder (NEORV32_HOME): $(NEORV32_HOME)"
@echo "IMAGE_GEN: $(IMAGE_GEN)"
@echo "LD script: $(LD_SCRIPT)"
@echo "Core source files:"
@echo "$(CORE_SRC)"
@echo "Core include folder:"
@echo "$(NEORV32_INC_PATH)"
@echo "---------------- Info: Objects ----------------"
@echo "Project object files:"
@echo "$(OBJ)"
@echo "---------------- Info: RISC-V CPU ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: RISC-V Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Libraries ----------------"
@echo "MARCH: $(MARCH)"
@echo "MABI: $(MABI)"
@echo "---------------- Info: Toolchain ----------------"
@echo "Toolchain: $(RISCV_TOLLCHAIN)"
@echo "CC: $(CC)"
@echo "OBJDUMP: $(OBJDUMP)"
@echo "OBJCOPY: $(OBJCOPY)"
@echo "SIZE: $(SIZE)"
@echo "---------------- Info: Compiler Libraries ----------------"
@echo "LIBGCC:"
@$(CC) -print-libgcc-file-name
@echo "SEARCH-DIRS:"
@$(CC) -print-search-dirs
@echo "---------------- Info: Flags ----------------"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "USER_FLAGS: $(USER_FLAGS)"
@echo "CC_OPTS: $(CC_OPTS)"
@echo "---------------- Info: Host Native GCC Flags ----------------"
@echo "CC_X86: $(CC_X86)"
@echo "CC_X86: $(CC_X86)"
 
 
# -----------------------------------------------------------------------------
291,12 → 308,12
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile/toolchain configuration"
@echo " compile - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image"
@echo " exe - compile and generate <neorv32_exe.bin> executable for upload via bootloader"
@echo " install - compile, generate and install VHDL IMEM boot image (for application)"
@echo " all - compile and generate <neorv32_exe.bin> executable for upload via bootloader and generate and install VHDL IMEM boot image (for application)"
@echo " clean - clean up project"
@echo " clean_all - clean up project, core libraries and image generator"
@echo " bootloader - compile, generate and install VHDL BOOTROM bott image (for bootloader only!)"
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)"
 
 
# -----------------------------------------------------------------------------
303,8 → 320,7
# Clean up
# -----------------------------------------------------------------------------
clean:
@rm -f *.elf *.o *.bin *.out *.s
@rm -f *.elf *.o *.bin *.out *.asm *.vhd
 
clean_all: clean
@rm -f $(OBJ) $(IMAGE_GEN)
 
/sw/example/makefile
41,7 → 41,7
.SUFFIXES:
.DEFAULT_GOAL := help
 
TOPTARGETS := compile clean_all check info
TOPTARGETS := exe clean_all check info all
 
SUBDIRS := $(wildcard */.)
# ignore dummy folders (starting with '~')
60,11 → 60,12
# Help
#-------------------------------------------------------------------------------
help:
@echo "Compile / clean up all projects"
@echo "Build / clean up all projects"
@echo "Targets:"
@echo " help - show this text"
@echo " check - check toolchain"
@echo " info - show makefile configuration"
@echo " compile - compile all projects"
@echo " exe - create executables from all projects"
@echo " all - create executables and boot images from all projects"
@echo " clean_all - clean up everything"
 
/.gitignore
2,19 → 2,20
*.bin
*.o
*.elf
*.s
*.asm
*.out
*_image.vhd
 
# keep the start-up codes
!sw/common/*.S
# keep default VHDL memory images
!rtl/core/*_image.vhd
 
# no executables
# no host executables
sw/image_gen/image_gen
sw/image_gen/image_gen.exe
 
# no temp/legacy files/folders
# no temporary/legacy files/folders
*.tmp
~*
*.tmp
 
# no stuff generated by doxygen
docs/doxygen_build

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.