HP Forums
Flashing HP15CE with linux - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Flashing HP15CE with linux (/thread-22776.html)

Pages: 1 2 3


RE: Flashing HP15CE with linux - AnnoyedOne - 11-27-2024 06:06 PM

(11-27-2024 05:52 PM)Idnarn Wrote:  The fact that it found the chip ID 0xab0a07e1 (Atmel ATSAM4LC2CA) suggests that USB communication is working fine.

It looks that way.

From the ATSAM4LC2CA datasheet (PDF) the ChipID value looks ok.

A1


RE: Flashing HP15CE with linux - blackjetrock - 11-27-2024 07:35 PM

(11-27-2024 05:52 PM)Idnarn Wrote:  
(11-27-2024 04:09 PM)blackjetrock Wrote:  -I- Found chip : at91sam4l_1 (Chip ID : 0xffffffffab0a07e1)

The fact that it found the chip ID 0xab0a07e1 (Atmel ATSAM4LC2CA) suggests that USB communication is working fine. Can you strace the process and see where it's blocking?
Code:


write(1, "-I- Loading applet applet-flash-"..., 66-I- Loading applet applet-flash-sam4l4.bin at address 0x20002000
) = 66
readlink("/home", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, "/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin", O_RDONLY) = 6
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
ioctl(6, TCGETS, 0x7ffe2c343760)        = -1 ENOTTY (Inappropriate ioctl for device)
stat("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin", {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0
read(6, "\360\177\0 \t(\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 2652
write(5, "S20002000,a5c#\n", 15)        = 15
write(5, "\360\177\0 \t(\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2653) = 2653
close(6)                                = 0
write(5, "W20002040,0#\n", 13)          = 13
write(5, "W20002048,0#\n", 13)          = 13
write(5, "W2000204c,4#\n", 13)          = 13
write(5, "W20002050,0#\n", 13)          = 13
write(5, "G20002000#\n", 11)            = 11
write(5, "w20002040,4#\n", 13)          = 13
read(5,



RE: Flashing HP15CE with linux - Sylvain Cote - 11-27-2024 09:13 PM

(11-27-2024 07:35 PM)blackjetrock Wrote:  
Code:
openat(AT_FDCWD, "/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin", O_RDONLY) = 6
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
ioctl(6, TCGETS, 0x7ffe2c343760)        = -1 ENOTTY (Inappropriate ioctl for device)
Just a reminder, in Unix/Linux almost everything is seen as a file, including a terminal (tty).
The ENOTTY (Error Not a typewriter) message is normally happening when a program is trying to configure a terminal (tty) properties but has opened a normal file.
So in summary, it looks like the program is trying to configure the serial port but it is talking to the applet-flash-sam4l4.bin file instead, thus the ENOTTY error.
Could you give us the command line that you typed ?


RE: Flashing HP15CE with linux - blackjetrock - 11-27-2024 09:21 PM

(11-27-2024 09:13 PM)Sylvain Cote Wrote:  
(11-27-2024 07:35 PM)blackjetrock Wrote:  
Code:
openat(AT_FDCWD, "/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin", O_RDONLY) = 6
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
ioctl(6, TCGETS, 0x7ffe2c343760)        = -1 ENOTTY (Inappropriate ioctl for device)
Just a reminder, in Unix/Linux almost everything is seen as a file, including a terminal (tty).
The ENOTTY (Error Not a typewriter) message is normally happening when a program is trying to configure a terminal (tty) properties but has opened a normal file.
So in summary, it looks like the program is trying to configure the serial port but it is talking to the applet-flash-sam4l4.bin file instead, thus the ENOTTY error.
Could you give us the command line that you typed ?

The command line was

sudo sam-ba_64

which then brought up the GUI. I selected /dev/ttyACM1 as the communication port and the sam4l board.
Pressing the CONNECT button then resulted in that trace (when running strace).


RE: Flashing HP15CE with linux - Sylvain Cote - 11-27-2024 09:29 PM

(11-27-2024 09:21 PM)blackjetrock Wrote:  
(11-27-2024 09:13 PM)Sylvain Cote Wrote:  Just a reminder, in Unix/Linux almost everything is seen as a file, including a terminal (tty).
The ENOTTY (Error Not a typewriter) message is normally happening when a program is trying to configure a terminal (tty) properties but has opened a normal file.
So in summary, it looks like the program is trying to configure the serial port but it is talking to the applet-flash-sam4l4.bin file instead, thus the ENOTTY error.
Could you give us the command line that you typed ?
The command line was
sudo sam-ba_64
which then brought up the GUI. I selected /dev/ttyACM1 as the communication port and the sam4l board.
Pressing the CONNECT button then resulted in that trace (when running strace).
ok ... let me think ... an invalid file permission could also produce this type of error.

type:
Code:
ls -la /home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin

edit: added command line


RE: Flashing HP15CE with linux - blackjetrock - 11-27-2024 09:41 PM

-rw-r--r-- 1 menadue menadue 2652 Nov 28 2017 /home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin


RE: Flashing HP15CE with linux - Sylvain Cote - 11-27-2024 09:55 PM

(11-27-2024 09:41 PM)blackjetrock Wrote:  -rw-r--r-- 1 menadue menadue 2652 Nov 28 2017 /home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin
since the user menadue has rw access, sudo should also been able to access it in rw mode.
I am on macOS right now, later tonight, I will load samba on one of my Linux machine to update one my 15CE calculator and see how it goes.
I will post my results here when it is done.
Sylvain


RE: Flashing HP15CE with linux - born2laser - 11-27-2024 10:47 PM

There is a gotcha I vaguely remember from when setting up PyILPer in Linux. You need to add the user to the dialup or tty group to be able to use serial ports with your username. This may be what is happening here (or not), you should be able to find those instructions floating around in the web

Juan


RE: Flashing HP15CE with linux - Idnarn - 11-28-2024 01:18 AM

(11-27-2024 07:35 PM)blackjetrock Wrote:  
(11-27-2024 05:52 PM)Idnarn Wrote:  The fact that it found the chip ID 0xab0a07e1 (Atmel ATSAM4LC2CA) suggests that USB communication is working fine. Can you strace the process and see where it's blocking?
Code:


write(1, "-I- Loading applet applet-flash-"..., 66-I- Loading applet applet-flash-sam4l4.bin at address 0x20002000
) = 66
readlink("/home", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
readlink("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek", 0x7ffe2c341ce0, 1023) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, "/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin", O_RDONLY) = 6
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
ioctl(6, TCGETS, 0x7ffe2c343760)        = -1 ENOTTY (Inappropriate ioctl for device)
stat("/home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/applet-flash-sam4l4.bin", {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0
read(6, "\360\177\0 \t(\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 2652
write(5, "S20002000,a5c#\n", 15)        = 15
write(5, "\360\177\0 \t(\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2653) = 2653
close(6)                                = 0
write(5, "W20002040,0#\n", 13)          = 13
write(5, "W20002048,0#\n", 13)          = 13
write(5, "W2000204c,4#\n", 13)          = 13
write(5, "W20002050,0#\n", 13)          = 13
write(5, "G20002000#\n", 11)            = 11
write(5, "w20002040,4#\n", 13)          = 13
read(5,

What is fd=5 in the strace output? is it the opened USB device? It appears that a read() on it is blocking after several writes(). Perhaps something has changed in the USB driver in recent kernel versions, that's causing the change in behavior.


RE: Flashing HP15CE with linux - Thomas Klemm - 11-28-2024 04:13 AM

(11-28-2024 01:18 AM)Idnarn Wrote:  What is fd=5 in the strace output?

We don't see that in the snippet of the output of strace here, but typically the file descriptor is the return value of an open call.
So, you'd have to search for something like:
Code:
open( … ) = 5
or
Code:
openat( … ) = 5



RE: Flashing HP15CE with linux - Sylvain Cote - 11-28-2024 01:24 PM

I have tried several things last night, all unsuccessful, they all stuck at the read instruction Sad

Notes:
  • sam-ba v2 was made in the 32-bit era (last release 2.18 was in 2017)
  • sam-ba v3 series does not support the 15CE CPU anymore.
  • installed several minor versions of sam-ba v2 series (2.15 to 2.18)
  • everything was tested on Ubuntu 22.04.5 64-bit bare-metal and on Ubuntu 16.04.6 32-bit in a VM.
  • sam-ba (or sam-ba_64) was run under $(whoami) and under root with sudo
  • sam-ba (or sam-ba_64) was run directly, with strace and with ltrace
  • $(whoami) and root was added to the dialout group to match /dev/ttyACM0 access root:dialout
  • at some point I changed the /dev/ttyACM0 access to $(whoami):dialout
  • created a softlink /dev/ttyUSB0 to point to /dev/ttyACM0 (just in case the code was looking for ttyUSB something)
  • dmesg confirmed that the /dev/ttyACM0 driver from Atmel was loaded correctly



RE: Flashing HP15CE with linux - AnnoyedOne - 11-28-2024 02:13 PM

(11-28-2024 01:24 PM)Sylvain Cote Wrote:  I have tried several things last night, all unsuccessful...

I don't know Linux but

(11-27-2024 04:09 PM)blackjetrock Wrote:  -I- Loading applet applet-flash-sam4l4.bin at address 0x20002000

looks wrong. The Windows version of SAM-BA 2.18 uses 0x20004000 (assigned when selecting the "board"?). The ATSAM4LC2CA starts its flash at 0x20000000 but the first 16KB is the write-protected bootloader so trying to write to 0x20002000 will fail.

Can the offset be changed from 0x2000 to 0x4000 as in the Windows version?

A1

PS: The AT91SAM7L128 had a 8KB bootloader so an offset of 0x2000 was correct for it.


RE: Flashing HP15CE with linux - Sylvain Cote - 11-28-2024 03:19 PM

(11-28-2024 02:13 PM)AnnoyedOne Wrote:  
(11-27-2024 04:09 PM)blackjetrock Wrote:  -I- Loading applet applet-flash-sam4l4.bin at address 0x20002000
looks wrong.
I had assumed that the given configuration/addresses were correct.
I do not have any free time for the coming days,
but I will look at the manual to figure out the upgrade process at the MCU level (memory map, boot loading sequence, etc.),
then I will look at the TCL scripts used by sam-ba on the Linux side to see which one matches what is needed, and if none, then create one that do.


RE: Flashing HP15CE with linux - AnnoyedOne - 11-28-2024 03:56 PM

From the HP-15C CE firmware programming instructions (PDF p3).

Quote:Put “0x04000” in the “Address” field, to place the pointer at the start of the user firmware and after the booting firmware of the Atmel processor. This is required to avoid overwriting the bootloader firmware at the beginning of the Atmel memory space.

A1

PS: From "Atmel SAM-BA for SAM4L (AN AT03454)" p4 of the PDF.


RE: Flashing HP15CE with linux - blackjetrock - 11-28-2024 04:40 PM

I had a go with the slightly different address, this still locked up.

Code:


menadue@project2:~/tree/hp15ce_programming/sam-ba_cdc_linux$ sudo ./sam-ba_64 
-I- Waiting ...
-I- TCL platform : Linux
-I- SAM-BA CDC 2.18  on : linux
-I- Connection : /dev/ttyACM0 (target(comType) = 0)
-I- Board : sam4l-ek[not factory programmed]
-I- Traces Level : 4
-I- target(handle) : file5
-I- sourcing board description file /home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/at91sam4l-ek.tcl
Read device Chip ID at 0x400E0740 --- get 0xffffffffab0a07e1
-I- Found chip : at91sam4l_1 (Chip ID : 0xffffffffab0a07e1)
-I- Loading applet applet-flash-sam4l4.bin at address 0x20004000



RE: Flashing HP15CE with linux - AnnoyedOne - 11-28-2024 04:55 PM

My mistake. The datasheet says that flash starts at 0x00000000 and RAM is at 0x20000000.

Try 0x4000.

A1

PS: Some chips remap stuff in bootloader mode. It seems that this one doesn't.


RE: Flashing HP15CE with linux - blackjetrock - 11-28-2024 05:56 PM

Same result, I'm afraid...

Code:

-I- Waiting ...
-I- TCL platform : Linux
-I- SAM-BA CDC 2.18  on : linux
-I- Connection : /dev/ttyACM0 (target(comType) = 0)
-I- Board : sam4l-ek[not factory programmed]
-I- Traces Level : 4
-I- target(handle) : file5
-I- sourcing board description file /home/menadue/tree/hp15ce_programming/sam-ba_cdc_linux/tcl_lib/at91sam4l-ek/at91sam4l-ek.tcl
Read device Chip ID at 0x400E0740 --- get 0xffffffffab0a07e1
-I- Found chip : at91sam4l_1 (Chip ID : 0xffffffffab0a07e1)
-I- Loading applet applet-flash-sam4l4.bin at address 0x4000



RE: Flashing HP15CE with linux - AnnoyedOne - 11-28-2024 06:04 PM

(11-28-2024 05:56 PM)blackjetrock Wrote:  Same result, I'm afraid...

I'm out of ideas. I tried...

It could be some obscure Linux issue. I've used SAM-BA 2.18 Windows in WinXP and Win7 virtual machines and it worked fine.

A1


RE: Flashing HP15CE with linux - blackjetrock - 11-28-2024 06:06 PM

I'm not too surprised. I started using PICs in about 1987, and carried on until about 8 years ago. The tools just sort of stopped working. I moved to other microcontrollers.

I think I'll be divesting myself of the HP15CEs...
Thanks for your help.


RE: Flashing HP15CE with linux - AnnoyedOne - 11-28-2024 06:10 PM

(11-28-2024 06:06 PM)blackjetrock Wrote:  I started using PIC...

Don't get me started on PIC's. Or 8051's (and variants).

A1