![]() |
Forum Index : Microcontroller and PC projects : CMM2: V5.05.06RC7
Page 1 of 4 ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10170 |
V5.05.06RC7 now available for download http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip Fixed bugs blitting to and from pages in SDRAM to pages in normal memory in 12 and 16-bit modes when x coordinates were odd numbers Fixed bug in SELECT where the selection was being made on an element of a string array Large performance improvements for all but the simplest programs |
||||
chris Regular Member ![]() Joined: 24/08/2020 Location: United KingdomPosts: 56 |
Thanks for all the hard work! |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1556 |
Hi Peter, No complaints from here! Many thanks. ![]() I got an impression of your efforts by reading the "readme.txt". Kind regards Michael Edited 2020-10-29 06:32 by twofingers causality ≠correlation ≠coincidence |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
INTO THE DARKNESS works perfectly now! Thanks for your hard work. |
||||
chris Regular Member ![]() Joined: 24/08/2020 Location: United KingdomPosts: 56 |
What's the FPS on the old versus new firmware? |
||||
Womble![]() Senior Member ![]() Joined: 09/07/2020 Location: United KingdomPosts: 267 |
Many thanks for this Peter, excellent work as always. ![]() Just one comment, I downloaded and installed the firmware (twice) and the splash screen and TerraTerm still list this as v5.05.06RC5. I flashed the firmware twice just to make sure I had the right version, and checked the file was CMM2V5.05.06RC7.bin Regards Womble |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1556 |
The splash screen should show v5.05.06RC7! If not, you made a mistake in the flash process. Please check the correct path here: Michael Edited 2020-10-29 11:16 by twofingers causality ≠correlation ≠coincidence |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1126 |
My splash screen shows RC7. So far, so good. Visit Vegipete's *Mite Library for cool programs. |
||||
Womble![]() Senior Member ![]() Joined: 09/07/2020 Location: United KingdomPosts: 267 |
Someting wierd going on here. I checked ... and flashed it twice with a known good USBA-A cable using "Update Firmware" as per normal. Done this lots of times. Doublechecked and I downloaded the zip file containing CMM2V5.05.06RC7.bin using the link above. Both times the splash screen was wrong. Time to redownload and try again. Womble Edit: Redownloaded from Peters post above: Followed the instructions in the Manual. Connected USBA-A cable, Update Firmware (entered via terraterm), disconnect USBA-B cable, Run STM32CubeProgrammer, load correct file and verify. Here is my logfile: 03:05:03 : STM32CubeProgrammer API v2.4.0 03:05:06 : USB speed : Full Speed (12MBit/s) 03:05:06 : Manuf. ID : STMicroelectronics 03:05:06 : Product ID : DFU in FS Mode 03:05:06 : SN : 200364500000 03:05:06 : FW version : 0x011a 03:05:06 : Device ID : 0x0450 03:05:06 : UPLOADING OPTION BYTES DATA ... 03:05:06 : Bank : 0x00 03:05:06 : Address : 0x5200201c 03:05:06 : Size : 308 Bytes 03:05:06 : UPLOADING ... 03:05:06 : Size : 1024 Bytes 03:05:06 : Address : 0x8000000 03:05:06 : Read progress: 03:05:06 : Data read successfully 03:05:06 : Time elapsed during the read operation is: 00:00:00.005 03:07:28 : Read File: C:\Users\Womble\Desktop\Colour Maximite 2\CMM2_Construction_Pack\CMM2_Beta_V5.05.06RC7\CMM2V5.05.06RC7.bin 03:07:28 : Number of segments: 1 03:07:28 : segment[0]: address= 0x0, size= 0xBCDC8 03:07:33 : Memory Programming ... 03:07:33 : Opening and parsing file: CMM2V5.05.06RC5.bin 03:07:33 : File : CMM2V5.05.06RC5.bin 03:07:33 : Size : 761544 Bytes 03:07:33 : Address : 0x08000000 03:07:33 : Erasing memory corresponding to segment 0: 03:07:33 : Erasing internal memory sectors [0 5] 03:07:37 : erasing sector 0000 @: 0x08000000 done 03:07:40 : erasing sector 0001 @: 0x08020000 done 03:07:42 : erasing sector 0002 @: 0x08040000 done 03:07:46 : erasing sector 0003 @: 0x08060000 done 03:07:48 : erasing sector 0004 @: 0x08080000 done 03:07:51 : erasing sector 0005 @: 0x080a0000 done 03:07:51 : Download in Progress: 03:07:56 : File download complete 03:07:56 : Time elapsed during download operation: 00:00:23.292 03:07:56 : Verifying ... 03:07:56 : Read progress: 03:07:59 : Download verified successfully Disconnect Programmer, Reset the CMM2, power down and reconnect the USBA-B. Fire up the CMM2 and ... ![]() SUSSED IT ![]() 03:05:06 : Time elapsed during the read operation is: 00:00:00.005 03:07:28 : Read File: C:\Users\Womble\Desktop\Colour Maximite 2\CMM2_Construction_Pack\CMM2_Beta_V5.05.06RC7\CMM2V5.05.06RC7.bin 03:07:28 : Number of segments: 1 03:07:28 : segment[0]: address= 0x0, size= 0xBCDC8 03:07:33 : Memory Programming ... 03:07:33 : Opening and parsing file: CMM2V5.05.06RC5.bin 03:07:33 : File : CMM2V5.05.06RC5.bin 03:07:33 : Size : 761544 Bytes 03:07:33 : Address : 0x08000000 I just tried again (4th time did the trick), turns out that although I had loaded the correct firmware file in the "Read Files" tab the programmer was changing it back to a previous version under the "File Path ... Browse Files" button. I had not noticed because my file path was too long. Change this to select the file again and Bingo, it worked. ![]() My Bad ... Thanks for all your help Womble NB. Wombles have Kapok for brains and can be a bit thick. Edited 2020-10-29 13:45 by Womble |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10170 |
V5.05.06RC8 now available for download http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip Fixed V5.05.05 bug where FLAC, MP3 and WAV file playback is distorted after using PLAY TTS Fixes V5.05.05 bug where the editor incorrectly changes the colour palette. Fixes V5.05.06 bug when using GOSUB NB: processing for both GOTO and GOSUB is VERY inefficient compared to using subroutines |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1126 |
This caught me out too before I got the hang of things. Perhaps the following will help remind me in the future: ============================= Updating the firmware on your Colour Maximite 2 You will need the STM32CubeProgrammer software. Follow the instructions at the end of the Colour Maximite 2 (CMM2) User Manual. Included here are some more images with bright red arrows and text to help you. Don't panic. A) Put the CMM2 into update mode (different methods, including "UPDATE FIRMWARE" or BOOT CONFIG switch or jumpers or ...) and connect to computer. (If you use the USB jack on a Waveshare board that is still plugged into the main board, the keyboard must be unplugged.) B) Run STM32CubeProgrammer, select port and connect ![]() C) Switch to programming ![]() D) Select firmware image file ![]() E) Write the new firmware to the CMM2 ![]() When successfully finished, click "Disconnect" (Connect button in first image above), power down the CMM2, set any jumpers or switches back to normal, connect cables as normal and turn it back on. Confirm correct firmware version on the splash screen. Set any desired options. (Then do it all over again because matherp just released a new version ;-) Visit Vegipete's *Mite Library for cool programs. |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1556 |
Hi Peter, sorry, I think some debugging functions are still active? I get a list of all functions, Subs and CSUBs first. SSTATUS, 0 PXY, 1 CPLOTXY, 2 CPLOTXYDEL, 3 CLEARWORLD, 4 PRINTLN, 5 DEMO0, 6 DEMO1, 7 DEMO2, 8 DEMO3, 9 DEMO4, 10 DEMO42, 11 DEMO5, 12 DEMOX, 13 DRANDOM, 14 TRANSFER, 15 SHOWGOLSLOTS, 16 KEYHELP, 17 LIFE_EDIT, 18 KEYHANDLER, 19 BACKUPGOLFILES, 20 CHECKNSAVEGOL, 21 SAVEGOL, 22 LOADGOL, 23 ASKYN, 24 SHOWMSG, 25 MENU_AND_EDITOR, 26 PREVIEW, 27 MENU, 28 DECLARE_KEYS, 29 CORE, 30 DUMMY, 31 Michael Edited 2020-10-30 04:12 by twofingers causality ≠correlation ≠coincidence |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10170 |
Oops, sorry. Please try again. |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1556 |
I did it! Much better now! ![]() Thank you! Regards Michael causality ≠correlation ≠coincidence |
||||
Womble![]() Senior Member ![]() Joined: 09/07/2020 Location: United KingdomPosts: 267 |
Excellent instructions Pete ![]() I was having a magic moment, and updating using my laptop not my usual desktop machine, forgot to check the browse button ![]() How does it go ... measure twice ... |
||||
NPHighview![]() Senior Member ![]() Joined: 02/09/2020 Location: United StatesPosts: 202 |
These look suspiciously like fast graphics operations: PXY, 1 CPLOTXY, 2 CPLOTXYDEL, 3 CLEARWORLD, 4 Are they documented anywhere? Inquiring minds want to know :-) Live in the Future. It's Just Starting Now! |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1556 |
DL again. causality ≠correlation ≠coincidence |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Hi, looks like bug in in 5.05.06RC8: When chosen OPTION EDIT FONT MEDIUM or OPTION EDIT FONT LARGE, the right cursor is damaging characters/screen in EDITOR (looks like cursor is going not just right but also a little bit down, maybe because difference in font height). My (not default) options are: OPTION BAUDRATE 230400 OPTION USB KEYBOARD US OPTION KEYBOARD REPEAT 500,80 Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10170 |
V5.05.06RC9 now available for download http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip This is just an internal tidy up of some of the new code but has resulted in another couple of percentage points of improvement in performance. I want to explain the new performance improvements in some detail so that those of you who want to get absolute maximum performance can understand how best this might be achieved and also to document them for future reference. The changes have been made in a way that minimises alterations to MMBasic in general and only significantly affect 4 C functions PrepareProgram(), findvar(), ClearVars(), and FindSubFun() CMM2 MMBasic now has three hash tables each with 512 elements. These are used for: Functions and subroutines - funtbl - located at &H30040000 Local variables- vartbl elements 0-511 - located at &H38000000 Global variables - vartbl elements 512-1023 - located at &H38008000 In addition there is a new LIFO (stack) maintained for currently used local variables. All hashing is done using a 32-bit FNV-1A hashing algorithm masked to 9-bits Note that in the case of "simple" variables (not arrays or strings), the variable itself is held in the hash table (64 bytes per variable - see s_vartbl structure in MMBasic.h). In the case of arrays or strings the hash table contains a pointer to the actual variable data. In the case of functions and subroutines the hash table (funtbl 36 bytes per element) contains a pointer to an element of a separate table (subfun) that contains the pointer to the subroutine/function in memory. This was done to minimise change to MMBasic internals. The mechanism of deleting a element in a hash table is as follows: 1. Look at the element of the hash generated 2. If the element is used and the details don't match increment the hash key modulus the size of the table and go back to step 1 3. We have now found the element to be deleted. Create a test key by incrementing the key to be deleted modulus the size of the table 4. Check the test key. If the test element is empty delete the element to be deleted. If the test element is not empty. Mark the element to be deleted as BLOCKED The mechanism of testing the existence of an element or inserting a new element into any of the three hash tables is as follows: 1. Look at the element for the hash generated. 2. If the element is BLOCKED make a note of the element number and go back to step 1 3. If the element is empty insert the new element details in any noted BLOCKED element or if none insert in the found empty element and return. 3. If the element is already used and the details match mark that the new element is already there and return. 4. If the element is used and the details don't match increment the hash key modulus the size of the table and go back to step 1 When a Basic program is loaded into memory (flash or RAM) all in-built MMBasic functions and subroutines are converted to single byte tokens as in all versions of MMBasic. In addition for the CMM2 everything except the contents of strings is converted to uppercase, comments are stripped from the program and all whitespace removed. When you run a program a list is created of all user subroutines and functions in the routine PrepareProgram() (table subfun[]), the names of the function/subroutine is then hashed and an index into the function/subroutine list is put into the function/subroutine hash table funtbl together with its name in ascii. This is the only change to the preparation of a Basic program for execution. When executing a Basic program the interpreter "interprets" the basic code reading it byte by byte. Anything "tokenised" can be dealt with very efficiently by using the token as a lookup to the address of the routine that executes that token. The work happens when the interpreter encounters something that isn't a token. I'll talk about the DIM, LOCAL and STATIC commands later but for the moment lets assume the interpreter encounters an ascii character that could mark the start of a variable (including an array or array element) or a used defined function/subroutine. In this case the interpreter progressively copies it and subsequent characters and builds a hash until it encounters a character that cannot be part of a variable or user subroutine/function name. Depending on the position in the line and the character that ends the string the interpreter knows that the string must be either a command, a simple variable, or a function/array. NB that because of Basic syntax at this point the interpreter can't know whether x(4) is the 4th element of array x or a call to function x with a parameter 4. The interpreter then uses the hash key generated to lookup the existence of the string as either a function/subroutine or a variable and depending on the result carries on processing. When processing is inside a subroutine the variable search will look at first at LOCAL variables defined within that subroutine and then at global variables When processing is at main program level the variable search will only look at global variables (by definition there will be no extant local variables at this point anyway - but see STATIC below) If when searching for a variable nothing is found and OPTION EXPLICIT is not specified and the terminating character is not a "(" then the interpreter will create a new global variable first checking that the variable name doesn't conflict with an existing function name. In the case that nothing is found and OPTION EXPLICIT is set you will get an error In the case that nothing is found and the string terminates with a "(" you will get an error In the case that nothing is found and the string is the same as an existing function you will get an error. The DIM command creates a GLOBAL variable irrespective of whether it is called in the main program or a subroutine. If the variable name already exists or the string is the same as an existing function you will get an error. Assuming all OK the variable is created in the global variable hash table. Before moving on to LOCAL variables we need to understand the concept of LocalIndex. MMbasic maintains a variable that indicates the depth of processing taking place. So when you call a function LocalIndex increases by one. If the main program calls a function which calls another function then in that second function LocalIndex will be 2. In fact all bracketed expressions also increase LocalIndex as MMBasic recursively calls its processing to resolve the user expression. The LOCAL command creates a variable in the LOCAL hash table. Together with the name of the variable, the value of LocalIndex is stored together with the other variable details. When matching a variable in the hash table the stored value of LocalIndex is included in the match. This means that a function with a local variable "i%" can call another function with its own local variable "i%" and these are kept separate. In this latter case the calculated hash key will be the same so a hash collision will occur. The LocalIndex is not included in the hash key as it is also used to check for conflict with a function/subroutine name. Note that this means there is a very small performance penalty for using the same variable names in functions that call each other. The STATIC command is an amalgam of DIM and LOCAL. The first time it is encountered it creates a global variable by concatenating the function name together with the variable name. It also creates a local variable with the user's variable name that is just a pointer to the global variable. On subsequent calls only the local variable is created as a pointer to the concatenated global variable name. Obviously the use of LOCAL variables is good programming practice but they do carry a processing overhead. Not only do they have to be created each time the function/subroutine is called but they have to be deleted on exit. This area is where a major performance improvement has been achieved. When each Local variable is created, not only does it get stored in the hash table for easy retrieval but its hash index is also pushed onto a LIFO stack. As part of the processing of END SUB, END FUNCTION, EXIT SUB, and EXIT FUNCTION the C routine ClearVars is called with the current LocalIndex. ClearVars now works by popping hash indexes off the LIFO stack until it encounters a stored value of LocalIndex on the variable less than the current value. The combination of the LIFO stack and the hashed variable location ensure this process works as efficiently as possible. The final two related user commands are ERASE and CLEAR. CLEAR erases all variables and can only be called from the main program where, by definition, there are no LOCAL variables extant. ERASE can only be used to delete a global variable. It uses the hash table deletion mechanism defined above to ensure any hash conflicts are managed properly Edited 2020-10-30 22:25 by matherp |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Still in V5.05.06RC9 Hi, looks like bug in in 5.05.06RC8: When chosen OPTION EDIT FONT MEDIUM or OPTION EDIT FONT LARGE, the right cursor is damaging characters/screen in EDITOR (looks like cursor is going not just right but also a little bit down, maybe because difference in font height). My (not default) options are: OPTION BAUDRATE 230400 OPTION USB KEYBOARD US OPTION KEYBOARD REPEAT 500,80 Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
Page 1 of 4 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |