![]() |
Forum Index : Microcontroller and PC projects : CMM2: V5.05.04b3a: CSUBs - not for the faint hearted!!!!
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
Hi Gerry, thank you for this contribution! Looks promising! ![]() BUT maybe I'm missing something?`After "Merge" or "Join" I get an error message: The C-code file compiles without issues if I use the old Make-file method. Any idea? Kind regards Michael Edited 2020-08-18 20:12 by twofingers causality ≠correlation ≠coincidence |
||||
GerryL Newbie ![]() Joined: 24/01/2019 Location: AustraliaPosts: 36 |
Hi Michael, I think my response I sent this morning maybe got lost so I'll repeat. It was my bad. I think I know what the issue is, can you place the linker script file, arm-gcc-link.ld, in the folder above the \bin folder where is currently should reside so its in same folder as CSubGen.bat (this bat file is generated by my program). If this resolves the issue then I will fix the program so it aligns with the instructions. Gerry |
||||
capsikin Guru ![]() Joined: 30/06/2020 Location: AustraliaPosts: 341 |
I kind of like the idea of making programs mostly in BASIC, but having some small FORTH routines where speed is needed. The main calculation loop in a fractal program, for example. FORTH is a simpler language than C in principle but I find it quite tricky to read large amounts of code in it. There was an old ZX81-style computer called the Jupiter Ace that had it built in instead of BASIC. I'd probably rather just stick to BASIC rather than mix languages though, for most programs. If you want something editable inline with BASIC (and you don't want a pre-processing or transcompiling step) then I would imagine it would probably need a very simple syntax and ~1:1 relationship with ARM machinecode so that the compiler/assembler could be squeezed into the firmware, i.e. either (a subset of) ARM assembler itself or some "made up assembler-like" language. Also given that MMBasic is already pushing on its design limit in terms of number of tokens and other complexity you would probably end up having to do a significant rewrite with all the problems with compatibility and adoption that would entail. Peter if you are reading this is there any significant space left for firmware or is it tinkering room only? the answer to that might close down the conversation pretty quickly. Regards, Tom I'm not so keen on using assembly language, partly because it's not portable, but it would be kind of reminiscent of 80's microcomputers. The BBC even had an assembler built in. You could have the assembler as a separate program, written in BASIC, if it's not built into the firmware. |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
Hi Gerry, the linker script file, arm-gcc-link.ld, was already in both folders. There is no "CSubGen.bat". I suspect a path issue ... But let us wait if more users encounter problems. ![]() Regards Michael causality ≠correlation ≠coincidence |
||||
GerryL Newbie ![]() Joined: 24/01/2019 Location: AustraliaPosts: 36 |
Thanks Michael, it’s a bit odd that the batch file is not in the ‘9 2020-q2-update’ folder. When activated my debugging log file gives all the correct file paths when I run the application on my system with the batch file, CSubGen.bat, in the parent folder to the linker/compiler (i.e C:\Program Files (x86)\GNU Arm Embedded Toolchain\9 2020-q2-update). If you selected an incorrect linker/complier path the application would flag this as it checks for arm-none-eabi-gcc.exe and arm-none-eabi-ld.exe being there. Not sure if it’s a permission issue in the program files folders. As you say let’s leave it for the time being. Gerry |
||||
chris Regular Member ![]() Joined: 24/08/2020 Location: United KingdomPosts: 56 |
I'm having trouble using the compiler. The code sample I put in the "main.c" file is the code sample in the first message in this thread. I added the compiler binary path to the PATH environment variable, and restarted the command prompt window, then I executed the following with the following results: C:\utils\cmm2ccompiler>arm-none-eabi-gcc -c -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wall -ffunction-sections -O0 -fPIC -Wno-main -I. main.c -o main.o arm-none-eabi-gcc: fatal error: cannot execute 'as': CreateProcess: No such file or directory compilation terminated. I searched for the error message online and found a reference to 'binutils' but I don't know if or how I should or can install this package. https://stackoverflow.com/questions/56801179/g-gcc-9-1-0-fatal-error-cannot-execute-as-execvp-no-such-file-or-directo I'm running Windows 10, 64-bit edition. UPDATE - NOW RESOLVED: The problem was that I was installing the GCC ARM compiler from the zip file download, which apparently doesn't install the dependencies that the compiler requires. Be sure to install from the .exe version. Edited 2020-09-17 09:16 by chris |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 499 |
Hey Thank you for this amazing thread... following these instructions I was able to create my first CSUB :D I checked the ARMCFunctions.h and there are some functions missing, like triangle. Is there a new header file version? I'm a Linux user, it will be nice to have tools that supports multiple plataform, maybe we can create a csub gen tool in python or other multi plataform language, what do you think? |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
Every function exposed in the header file needs code including in MMBasic to support it. It isn't as simple as just adding things to the header. I'm happy to consider things for inclusion but the shutter is just about to come down on V5.05.06 so you need to get in quickly with any requests |
||||
Sasquatch![]() Guru ![]() Joined: 08/05/2020 Location: United StatesPosts: 376 |
If you could expose the VideoColor (8,12,16 color bits) variable that would be great! -Carl |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 499 |
The drawing routines are welcome. For fast drawing in my 3D API I'll use them in CSUBs routines. Polygon, Triangle, Circle, Box, Arc ![]() |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
Polygon, Triangle, Circle, Box, Arc ![]() I don't know if it helps, but at least you have a function DrawPixel() and the source code. As far as I understand it, any change in "CFunctions.c" can lead to incompatibility with earlier versions and should therefore be done with care. But Peter will already know that, I am confident. ![]() Regards Michael Edited 2020-10-09 03:44 by twofingers causality ≠correlation ≠coincidence |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
Yes Drawrectangle (Box) already exists Circle and Triangle - yes Polygon and Arc - don't have suitable primitives and in any case there will be little advantage in calling in a CFunction as the parsing overhead is minimal |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
@Peter MMBasic has only the ability to use the RUN command with a string literal (RUN "FNAME.BAS") I can't use it with a string variable (eg RUN FName$). Do you think there is a way to circumvent this restriction - by changing the firmware or a CSub? It could be useful in making a better filemanager. BTW. The MMBasic for the Maximite 1 offers the opportunity to access the keyboard buffer with the Peek function (eg Peek (KBUF, +/- offset). There is an analog option for the CMM2? Thanks! causality ≠correlation ≠coincidence |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
No see the original thread for why. No - explain a use case that can't be satisfied with other capabilites |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
No see the original thread for why. I'm probably missing some context, but at the risk of contradicting Peter try this: Execute("Run " + Chr$(34) + f$ + Chr$(34) + ", " + cmdline$) Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
Any clue where to find it? ![]() No - explain a use case that can't be satisfied with other capabilites In the old days we (incorrectly) used the keyboard buffer to do actually impossible things. Eg to start a program (RUN FName$). Michael causality ≠correlation ≠coincidence |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 499 |
The idea to have the ability to call drawing routines on CSUB is because I need to perform a huge number of loops, calculations, and drawing API calls for rendering the 3D objects. When we think on only a few calls is not a problem to do it with pure basic, but for this scenario, an entire C routine will be better. Edited 2020-10-09 05:36 by LeoNicolas |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
@Tom That's GREAT! Thanks! ![]() ![]() I can confirm that it works! One step closer to a better file manager. ![]() @Leo When we think on only a few number of calls is not a problem do it with pure basic, but for this scenario an entire C routine will be better. I think your thought is correct. Michael PS: @Peter The manual says: I suggest including Tom's proposal in the manual. Thanks! Edited 2020-10-09 06:01 by twofingers causality ≠correlation ≠coincidence |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Hi folks, After a couple of weeks C bashing on my "Top secret project" (boy was I rusty in "C" after 20 years) I'm finally going to see whether I can build it as a CSUB and hopefully be able to talk about it (as either a success or failure) in less than a week. To avoid frustration, can someone (sorry Peter, that probably means you) confirm or deny: 1. The linker file I should use is still the one attached to the first post in this thread. 2. The options for converting the .elf file to CSUB are: * MMBasic for DOS running "armcfgenV143.bas" (included in the CMM2 firmware), or * @GerryL's CSUBGen.exe running on Windoze (or does this call out to the former ?) Also IIRC was there some function that the "C" code needs to call regularly to tell the firmware that it is still "alive" otherwise the CMM2 resets (or is it locks up?) Thanks, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1526 |
Also IIRC was there some function that the "C" code needs to call regularly to tell the firmware that it is still "alive" otherwise the CMM2 resets (or is it locks up?) ... I think what you mean is called "RoutineChecks()". the USB keyboard active and also ensure the watchdog doesn't trigger. CSUBs that run to completion within a couple of milliseconds can ignore this. http://geoffg.net/Downloads/Maximite/Colour_Maximite_2_User_Manual.pdf Regards ![]() Michael causality ≠correlation ≠coincidence |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |