Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile and flash automatically from Linux and Mac OS #44

Merged
merged 5 commits into from Dec 14, 2022

Conversation

IArchi
Copy link

@IArchi IArchi commented Nov 29, 2022

  • A new shell script is available to compile and flash from a Linux or Mac OS.
  • Script is automatically called from the GUI basing on the detected OS.
  • Users can now backup the firmware to eventually rollback changes.

@dzid26
Copy link

dzid26 commented Nov 29, 2022

There are some errors with the OS detection:
OSType should be removed.
Mac should be MacOS.

OSType os = getOperatingSystem();
                                    switch(os) {
                                        case Windows:
                                            process = Runtime.getRuntime().exec("cmd /c start compile_and_flash_20 " + backup_name);
                                            break;
                                        case MacOS:
                                        case Linux:
                                            process = Runtime.getRuntime().exec("compile_and_flash_20.sh " + backup_name);
                                            break;
                                        case Other:
                                        default:
                                            JOptionPane.showMessageDialog(null, " Unknown OS.\n Please run:\ncd src/controller && make && make clear_eeprom && make flash\nto compile and flash your TSDZ2.");
                                            break;
                                    }

It would be good to update jar file too. Here is jar and netbeans project files.
Java_Configurator_Source.zip Maybe you could add NetBeans project files to git? I found it in some older TSDZ2 fork. I haven't checked which files are sufficient to open the project.

@dzid26
Copy link

dzid26 commented Nov 29, 2022

Regarding EEPROM clearing.
Ideally, we shouldn't clear the EEPROM after programming if the parameter structure doesn't change or is appended.
But the structure did change like 8 months ago ff8a313 .

I don't know. I guess it's not that serious and the clearing is ok by default. But I modify it locally not to clear.
The best would be to read the software version and store a table for the script to decide between which releases eeprom needs to be cleared.

Add fallback and default answer.
Fix typo. Improve script execution to display in a terminal.
@IArchi
Copy link
Author

IArchi commented Nov 29, 2022

I've fixed my code. I've pushed the wrong version earlier.
Now, on Linux and MacOS devices, it opens a terminal like on Windows.

Regarding EEPROM, if I'm not wrong, you are already doing the samething with that Windows command:
STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -FileData=data_empty.ihx -verbose -no_loop -verif -no_warn_protect
Especially this parameter: -FileData=data_empty.ihx

On Linux and MacOS, the clear_eeprom command uses the same file:
stm8flash -c stlinkv2 -p stm8s105?6 -w data_empty.ihx

@dzid26
Copy link

dzid26 commented Nov 29, 2022

Regarding EEPROM, if I'm not wrong, you are already doing the samething with that Windows command: STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -FileData=data_empty.ihx -verbose -no_loop -verif -no_warn_protect Especially this parameter: -FileData=data_empty.ihx
This line was added by @emmebrusa when he was merging, due to some USB issue. Initially, in my PR changes, I was not clearing the EEPROM.

I think it's going to be up to him whether to clear it or not.

Update bash script to allow later edit :)
@emmebrusa
Copy link
Owner

  • Script is automatically called from the GUI basing on the detected OS.

I tried the proposed changes in Ubuntu 22.04, clicking Compile&Flash in configurator, it creates ini and config.h files, but compile_and_flash_20.sh doesn't start (Allow executing file as program is enabled).
I state that I know little about Linux, what could be the problem?

@emmebrusa emmebrusa merged commit 5706639 into emmebrusa:master Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants