Cumulus Firware Compilation

This is the right place to discuss on how to implement hardware vsync, adding a VIA or AY chipset, puting multiple roms, or how to design a new flash expansion card.
Post Reply
User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Cumulus Firware Compilation

Post by Dbug » Fri Jan 17, 2014 9:28 pm

Hello,
I'm currently trying to debug a problem with my new loader, which involves the following process:
- Modify the code on the PC
- Build the new DSK
- Copy the DSK file to the SD Card (and eject it properly)
- Move the SD Card to Cumulus
- Select the DSK file
- Select 'reset oric' and press YES

I can think of ways to make it simpler for me to test by having a 'automatically refresh the sd card and then reset the oric' button, but for that I need to know how to compile the firmware.

I see in the README.txt the following:
The /fw subfolder contains C sources for the PIC18F46K20 firmware, for compilation with MPLAB C18 compiler under MPLAB IDE. Configuration bits are included in main.c.
Could somebody write a small explanation on how to do that for the hardware n00bs?

Thanks :)

User avatar
metadata
Pilot Officer
Posts: 114
Joined: Wed Aug 31, 2011 7:59 pm
Location: Hildesheim, Germany
Contact:

Re: Cumulus Firware Compilation

Post by metadata » Sat Jan 18, 2014 12:08 pm

Could somebody write a small explanation on how to do that for the hardware n00bs?
:)

here is a quick explanation:
1. download and install mplabx and install it
2. download and install the C18 compiler from microchip
3. create a new project in the mplabx ide
-standalone
-PIC18F46K20
-Hardwaretools are not importent so select ICD3 for example
-Compiler select the C18
-Name the project
4. Open the Project window (Windows->Project)
- Right click "header files" in your project and the "add existing item" and select your .h files
- Right click "linker files" in your project and the "add existing item" and select your .lkr file
- Right click "source files" in your project and the "add existing item" and select your .c files
5. click "run" -> "Build project"
6. Download http://hex2bin.sourceforge.net/
7. copy the generated .hex file in your hex2bin folder
8. open command window (cmd) and go to hex2bin folder
9. type: hex2bin -l 10000 YOURHEXFILENAME
:)

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 12:16 pm

On this page they seem to imply that for C18 it should be MPLAB® XC 8 instead, is that correct?
https://www.microchip.com/pagehandler/e ... s/mplabxc/

User avatar
metadata
Pilot Officer
Posts: 114
Joined: Wed Aug 31, 2011 7:59 pm
Location: Hildesheim, Germany
Contact:

Re: Cumulus Firware Compilation

Post by metadata » Sat Jan 18, 2014 1:43 pm

it seems that the c18 compiler is legacy. So yes this is the new one.

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 1:51 pm

I got errors when building:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `D:/svn/public/oric/hardware/cumulus/Build'
make -f nbproject/Makefile-default.mk dist/default/production/Build.production.hex
make[2]: Entering directory `D:/svn/public/oric/hardware/cumulus/Build'
"C:\Program Files (x86)\Microchip\xc8\v1.30\bin\xc8.exe" --pass1 --chip=18F46K20 -Q -G --double=24 --float=24 --emi=wordwrite --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,+plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -obuild/default/production/_ext/43900800/179X.p1 ../fw/179X.c
(908) exit status = 1
make[2]: *** [build/default/production/_ext/43900800/179X.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
../fw/fat32.h:93: error: (372) "," expected
../fw/6610.h:71: error: (372) "," expected
../fw/6610.h:77: error: (372) "," expected
../fw/6610.h:78: error: (372) "," expected
../fw/6610.h:80: error: (372) "," expected
../fw/ui.h:44: error: (372) "," expected
../fw/179X.c:50: warning: (335) unknown pragma "romdata"
../fw/179X.c:52: warning: (374) missing basic type; int assumed
../fw/179X.c:52: error: (314) ";" expected
../fw/179X.c:53: warning: (374) missing basic type; int assumed
../fw/179X.c:53: error: (314) ";" expected
../fw/179X.c:56: warning: (374) missing basic type; int assumed
../fw/179X.c:56: error: (372) "," expected
../fw/179X.c:56: warning: (983) storage class redeclared for "uint8_t"
../fw/179X.c:56: error: (1098) conflicting declarations for variable "uint8_t" (../fw/global.h:27)
make[2]: Leaving directory `D:/svn/public/oric/hardware/cumulus/Build'
make[1]: Leaving directory `D:/svn/public/oric/hardware/cumulus/Build'

BUILD FAILED (exit value 2, total time: 3s)
Some people had similar issues (romdata not recognized) on https://www.microchip.com/forums/m702618-print.aspx and apparently they advise to use the C18 compiler, guess I need to find it, even if it's deprecated. Or we have to fix the code, that's possibly a better idea on the long run?

User avatar
metadata
Pilot Officer
Posts: 114
Joined: Wed Aug 31, 2011 7:59 pm
Location: Hildesheim, Germany
Contact:

Re: Cumulus Firware Compilation

Post by metadata » Sat Jan 18, 2014 1:55 pm

the code is written for the c18 compiler. maybe there are not 100% compatible.
so use this one: http://www.microchip.com/stellent/idcpl ... e=en010014
maybe you have too register an account. but it is free.

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 2:18 pm

Yup, works better with the C18 compiler:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `D:/svn/public/oric/hardware/cumulus/Build'
make -f nbproject/Makefile-default.mk dist/default/production/Build.production.hex
make[2]: Entering directory `D:/svn/public/oric/hardware/cumulus/Build'
"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/179X.o ../fw/179X.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/6610.o ../fw/6610.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/UI.o ../fw/UI.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/fat32.o ../fw/fat32.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/main.o ../fw/main.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/sd-mmc.o ../fw/sd-mmc.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mcc18.exe" -p18F46K20 -ms -oa- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\h -fo build/default/production/_ext/43900800/utility.o ../fw/utility.c
MPLAB C18 v3.46 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 60

WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

"C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin\mplink.exe" "..\fw\fw.lkr" -p18f46k20 -w -m"dist/default/production/Build.production.map" -z__MPLAB_BUILD=1 -u_CRUNTIME -l "C:\Program Files (x86)\Microchip\mplabc18\v3.46\bin"\\..\\lib -o dist/default/production/Build.production.cof build/default/production/_ext/43900800/179X.o build/default/production/_ext/43900800/6610.o build/default/production/_ext/43900800/UI.o build/default/production/_ext/43900800/fat32.o build/default/production/_ext/43900800/main.o build/default/production/_ext/43900800/sd-mmc.o build/default/production/_ext/43900800/utility.o
MPLINK 4.48, Linker
Device Database Version 1.13
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors : 0

MP2HEX 4.48, COFF to HEX File Converter
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors : 0

make[2]: Leaving directory `D:/svn/public/oric/hardware/cumulus/Build'
make[1]: Leaving directory `D:/svn/public/oric/hardware/cumulus/Build'

BUILD SUCCESSFUL (total time: 5s)
Loading code from D:/svn/public/oric/hardware/cumulus/Build/dist/default/production/Build.production.hex...
Loading symbols from D:/svn/public/oric/hardware/cumulus/Build/dist/default/production/Build.production.cof...
Loading completed
What about the WARNING: The procedural abstraction optimization will not be supported when the evaluation becomes feature limited.

Will that have an impact on the generated code, or will it not matter with Cumulus?

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 2:21 pm

Bonus question: Could you attach/post the version of the .bin file you created? That would have two purposes:
- If I blow, I can reflash with the correct version
- It will allow me to compare the size/binary with yours :)

Also, what are the constraints? If I change the code, messages, colors, add UI pages, etc... will I ran out of space? Is that checked somewhere?

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 2:39 pm

That did not work very well.
So I got a .hex file (and .cof and .map) from the MPLAB + C18 toolchain,
I ran the .hex file with Hex2Bin but got some warnings:
C:\Tools\Hex2bin-1.0.10\Windows>hex2bin -l 10000 Build.production.hex
hex2bin v1.0.10, Copyright (C) 2012 Jacques Pelletier & contributors

Overlapped record detected
Overlapped record detected
Overlapped record detected
Overlapped record detected
Lowest address = 00000000
Highest address = 0000FFFF
Pad Byte = FF
8-bit Checksum = A1
Then I renamed the file as CUMULUS.BIN, copied it to my SDCARD, and booted the device with the two left button pressed as shown on your video.
All I get is a red screen with few garbled things on the top, looks like broken charset.

After booting normally the Cumulus is still working so no harm done :)

What did I do wrong?
I can zip/send the whole project if needed

So what I used is:
* MPLAB X IDE v2.00
* C18 (v3.46)
* Hex2bin 1.0.10

User avatar
metadata
Pilot Officer
Posts: 114
Joined: Wed Aug 31, 2011 7:59 pm
Location: Hildesheim, Germany
Contact:

Re: Cumulus Firware Compilation

Post by metadata » Sat Jan 18, 2014 2:48 pm

Will that have an impact on the generated code, or will it not matter with Cumulus?
it will only matter in the size. so it is important for the bootloader. but as long the firmware is not too big is doesn't matter.
Then I renamed the file as CUMULUS.BIN, copied it to my SDCARD, and booted the device with the two left button pressed as shown on your video.
All I get is a red screen with few garbled things on the top, looks like broken charset.
That's an error message. it was not possible to compile the fonts in the bootloader. so i can only display boxes and lines on the display to find the error.
After booting normally the Cumulus is still working so no harm done
that's because the bootloader checks the size of the firmware first. If it is too big it will not update the cumulus.
Bonus question: Could you attach/post the version of the .bin file you created? That would have two purposes:
- If I blow, I can reflash with the correct version
I upload the two versions in a minute.

User avatar
metadata
Pilot Officer
Posts: 114
Joined: Wed Aug 31, 2011 7:59 pm
Location: Hildesheim, Germany
Contact:

Re: Cumulus Firware Compilation

Post by metadata » Sat Jan 18, 2014 3:00 pm

Cumulus Firmware:
Cumulus-PCF8833.zip
Cumulus-PCF8833
(14.14 KiB) Downloaded 319 times
(for all Cumulus without the black dot on the PCB above the 3 buttons)
Cumulus-S1D15G10.zip
Cumulus-S1D15G10
(14.18 KiB) Downloaded 354 times
(for all Cumulus with the black dot on the PCB above the 3 buttons)

Using the wrong firmware is not a big problem. When you see nothing on the screen just flash the other firmware.

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 3:35 pm

Working :)
Basically two things:
* The card has to be readable/accepted by the device
* It has to be called CUMULUS.BIN, not Cumulus.bin or cumulus.bin
Cumulus0.6.JPG
Firmware 0.6 :)
Cumulus0.6.JPG (87.17 KiB) Viewed 10202 times

User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Cumulus Firware Compilation

Post by Dbug » Sat Jan 18, 2014 5:47 pm

Played a bit more with the code, first did a color theme change because I wanted to start by something simple.
Cumulus0.6-about.JPG
Cumulus0.6-about.JPG (61.71 KiB) Viewed 10177 times
Then I added the SIDE and SECTOR information on the main page because it's practical to have when working on a demo loader :)
Cumulus0.6-main.JPG
Cumulus0.6-main.JPG (67.45 KiB) Viewed 10177 times
My next change will be to move the WRITE PROTECT to a sub menu and use the third button instead for a reload/reset operation.

User avatar
metadata
Pilot Officer
Posts: 114
Joined: Wed Aug 31, 2011 7:59 pm
Location: Hildesheim, Germany
Contact:

Re: Cumulus Firware Compilation

Post by metadata » Sat Jan 18, 2014 6:22 pm

:) really cool.

User avatar
ibisum
Squad Leader
Posts: 877
Joined: Fri Apr 03, 2009 8:56 am

Re: Cumulus Firware Compilation

Post by ibisum » Sat Jan 18, 2014 8:57 pm

Really, really cool!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest