Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:59 23 Dec 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite V6.00.01 release candidates - please test thoroughly

     Page 20 of 20    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9285
Posted: 10:45am 22 Dec 2024
Copy link to clipboard 
Print this post

Harm

Please check this

PicoMite.zip
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1303
Posted: 11:19am 22 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,
I think there is a problem with "Autosave append" and the heap memory.
If I cancel "autosave append" with CTRL-C, I only have 3328k heap memory instead of 183kB. Only after a "NEW" do I have 183KB again
> memory
Program:
  3K ( 1%) Program (162 lines)
177K (99%) Free

Saved Variables:
 16K (100%) Free

RAM:
  0K ( 0%) 0 Variables
  0K ( 0%) General
228K (100%) Free
> ? mm.info(heap)
183808
> autosave append
> ? mm.info(heap)
3328
> memory
Program:
  3K ( 1%) Program (162 lines)
177K (99%) Free

Saved Variables:
 16K (100%) Free

RAM:
  0K ( 0%) 0 Variables
176K (77%) General
 52K (23%) Free
> new
> ? mm.info(heap)
183808
> autosave append
> ? mm.info(heap)
3328
> autosave append
Error : Not enough Heap memory
>

I think this is a low priority issue. I just wanted you to know about it.
If you don't know the reason and the problem suddenly occurs, it's confusing.
Regards
Michael
Edited 2024-12-22 21:25 by twofingers
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9285
Posted: 12:21pm 22 Dec 2024
Copy link to clipboard 
Print this post

Michael: thanks for the report - easily fixed

Note to Harm

BAD
If MM.Device$ = "PicoMiteVGA" Then


GOOD
if instr(MM.Device$, "PicoMiteVGA") Then

Edited 2024-12-22 22:23 by matherp
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 379
Posted: 02:21pm 22 Dec 2024
Copy link to clipboard 
Print this post


> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.01RC9
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD GR
OPTION CPUSPEED (KHz) 315000
OPTION DISPLAY 30, 53
OPTION SDCARD GP22, GP26, GP27, GP28
OPTION AUDIO GP10,GP11', ON PWM CHANNEL 5
OPTION RTC AUTO ENABLE
OPTION MODBUFF ENABLE  192
OPTION PLATFORM HDMIUSB
> files
A:/
  <DIR>  .
  <DIR>  ..
15:12 22-12-2024      19340  book.txt
14:44 22-12-2024          4  bootcount
14:57 22-12-2024      22542  fm.bas
15:12 22-12-2024      38216  picochess4.bas
15:12 22-12-2024      28854  small.bmp
2 directories, 5 files, 2260992 bytes free
> Sprite Loadbmp 1, "small.bmp",x,y,18,18
Error : Could not find the file
>


Is this possibly a bug?
I have added .bmp, I have copied it to "a:" and I have also tried 'a:small.bmp' and 'a:/small.bmp'...
I came across this in ‘picochess4.bas’.

Matthias
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9285
Posted: 03:30pm 22 Dec 2024
Copy link to clipboard 
Print this post

bug - will fix
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9285
Posted: 04:33pm 22 Dec 2024
Copy link to clipboard 
Print this post

V6.00.01RC10

PicoMiteRP2040V6.00.01RC10.zip

PicoMiteRP2350V6.00.01RC10.zip


Please, please if reporting any issues specify the exact version used and list all options set

Bug fixes
Bug in SPRITE LOADBMP not finding the file
Memory leak when AUTOSAVE APPEND is exited with Ctrl-C
Crashes in WebMite2040 caused by system heap being exceeded (in since 5.09)
Bug in VGA RP2040 caused by system/firmware memory overrun

Modifications
Tweaks the PSRAM timings to allow 372MHz operation of Pimoroni boards with RP2350B and 8Mb PSRAM. This enables 1280P resolution with a RP2350B running HDMI firmware


New functionality

LONGSTRING AES128 ENCRYPT/DECRYPT CBC/ECB/CTR key$/key[!/%](), in%(), out%() [,iv$/iv[!/%]()]

Encrypts or decrypts the longstring in in%() putting the answer in out%()
For CBC and CTR modes the encryption will generate a random initialisation vector and prepend out%() with the IV. If an explicit IV is specified this will be used instead of the random vector and this will be prepended to out%()
For CBC and CTR decryption the firmware assumes that the first 16 bytes of in%() are the initialisation vector.
In the case where you want to transmit a message without IV you can use LONGSTRING RIGHT to remove the IV before sending the message. In this case the recipient must know the IV as well as the key and create a complete longstring before using DECRYPT. This can be done by using LONGSTRING CONCAT to add the incoming message to a longstring containing the IV.

LONGSTRING BASE64 ENCODE/DECODE in%(), out%()

This BASE64 encodes or decodes the longstring in in%() placing the answer in out%(). The array used as the output must be big enough relative to the input and the direction. Encoding increases length by 4/3 and decoding decreases it by 3/4

Function
MATH(BASE64 ENCODE/DECODE in$/in(), out$/out())

Returns the length of out$/out(). This base64 encodes or decodes the data in 'in' and puts the result in 'out'. Where arrays are used as the output they must be big enough relative to the input and the direction. Encryption increases length by 4/3 and decryption decreases it by 3/4

Command
MATH AES128 ENCRYPT/DECRYPT CBC/ECB/CTR key$/key(), in$/in(), out$/out() [,iv$/iv()

This command encrypts or decrypts the data in 'in' and puts the answer in 'out' using the AES128 encryption method specified
The parameters can each be either a string, integer array, or float array with any mix possible
The key must be 16 elements long (16*8=128bits)
in and out must be a multiple of 16 elements long.
In the case of out being specified as a string (e.g. out$), the string variable must exist and should be set to empty (DIM out$="")
The maximum number of elements in 'in' and 'out' is limited by memory when defined as arrays. Strings for encrypting are limited to 240bytes (EBR) and 224bytes (CTR and CBC).
For CBC and CTR encryption you can optionally specify an initialisation vector 'iv'. 'iv' must be 16 elements long (16*8=128bits). If an initialisation vector is not specified encryption will generate a random initialisation vector.
In both cases the output is prepended with the IV.
For CBC and CTR, decryption requires that the first 16 elements of the input are the initialisation vector.
In the case where you want to transmit a message without IV you should remove the IV before sending the message using standard MMBasic manipulations. In this case the recipient must know the IV as well as the key and create a complete message before using DECRYPT by prepending the IV to the incoming message.
Edited 2024-12-23 03:00 by matherp
 
javavi

Senior Member

Joined: 01/10/2023
Location: Ukraine
Posts: 296
Posted: 05:25pm 22 Dec 2024
Copy link to clipboard 
Print this post

PicoMiteHDMI MMBasic RP2350A Edition V6.00.01RC10
OK! PSRAM (ESP-PSRAM64H 133MHz) works in 640 & 1024 HDMI resolutions
640 @315MHz | 1024 @324MHz |
When changing the HDMI resolution to 1280, the following message appears at startup:
Invalid clock speed - reset to default
the resolution is reset to 640 but the default font settings remain FONT 3

All these innovations are already reaching the minor version PicoMite V6.01
Edited 2024-12-23 03:35 by javavi
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9285
Posted: 05:36pm 22 Dec 2024
Copy link to clipboard 
Print this post

Just do Option RESET to clear up. The test for working just attempts to get the firmware to run and doesn't try to tidy up.
 
javavi

Senior Member

Joined: 01/10/2023
Location: Ukraine
Posts: 296
Posted: 06:01pm 22 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  Just do Option RESET to clear up. The test for working just attempts to get the firmware to run and doesn't try to tidy up.

In my case, this reset leads to the need to configure all the options again.
This is especially difficult on PicoMite USB editions, since my board does not have USB-UART on the pins by default. Although there is the ability to connect an external USB Hub.

Edited 2024-12-23 04:03 by javavi
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1303
Posted: 09:01pm 22 Dec 2024
Copy link to clipboard 
Print this post

About: V6.00.01RC10

Hi Peter,
AFAIK is there an issue with
Math aes128 decrypt ctr key$,out$,comp$,iv$

I suspect that only the IV$ part (initialisation vector) is affected. If "IV$" is commented out it works (iv_enabled=0).
The longstring DEcrypt version also works!
LongString AES128 DECRYPT CTR key$, lout%(), lcomp%() ,iv$



Demo code.
' Peters aes demo program for Picomites
' modified for ascii input by twofingers@TBS
Option explicit
CLS
Const iv_enabled = 0 ' IV on/OFF <<<<<<<<<<<<<-------------------
Dim string in$="",out$="",comp$=""
Dim integer i
Dim key$ ="0123456789ABCDEF" 'Your "Password"
Dim IV$  ="0123456789012345" 'initialisation vector
'convert the message to a string version of the message
Print
Input "Your message (max 224): ", in$
Inc in$,String$((16-Len(in$) Mod 16)Mod 16,0)
' encrypt the message
If iv_enabled Then
  Math aes128 encrypt ctr key$,in$,out$,iv$
Else
  Math aes128 encrypt ctr key$,in$,out$',iv$
EndIf

IV$=Left$(out$,16)
Print "1> "out$,Len(IV$),Len(out$)

If iv_enabled Then out$=Mid$(out$,17)
Print "2> "out$,Len(IV$),Len(out$)
'decrypt the message
If iv_enabled Then
 Math aes128 decrypt ctr key$,out$,comp$,iv$
Else
 Math aes128 decrypt ctr key$,out$,comp$',iv$
EndIf
Print out$
Print comp$
'check for errors
If in$<>comp$ Then Print "WTF" Else Print "Okay"
End

Regards
Michael


This is a working example using "Longstring AES ..." for decrypting:
' Peters aes demo program for Picomites
' modified for ascii input by twofingers@TBS
Option explicit
CLS
Dim string in$="",out$="",comp$=""
Dim integer i
Dim key$ ="0123456789ABCDEF" 'Your "Password"
Dim IV$  ="0123456789012345" 'initialisation vector
Dim lout%(2048),lcomp%(2048)

'convert the message to a string version of the message
Print
Input "Your message (max 224): ", in$
Inc in$,String$((16-Len(in$) Mod 16)Mod 16,0)
' encrypt the message
Math aes128 encrypt ctr key$,in$,out$,iv$
LongString append lout%(),out$

'decrypt the message
LongString AES128 DECRYPT CTR key$, lout%(), lcomp%() ,iv$
comp$ = LGetStr$(lcomp%(), 1, Len(in$))
'Math aes128 decrypt ctr key$,out$,comp$,iv$
Print out$
Print comp$
'check for errors
If in$<>comp$ Then Print "WTF" Else Print "Okay"
End

Edited 2024-12-23 07:30 by twofingers
causality ≠ correlation ≠ coincidence
 
     Page 20 of 20    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024