Skip to content

Commit

Permalink
Merge pull request #2 from SonixQMK/main
Browse files Browse the repository at this point in the history
Enable flashing on sonix boards without sonix VIDPID
  • Loading branch information
Jpe230 authored Mar 23, 2022
2 parents a829d17 + 6a59169 commit 41ae51c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# SonixFlasherC
Dead Simple flasher.
# Sonix Flasher C

A CLI-based Flasher for Sonix 24x/26x MCUs.

## Description

This flasher is aimed for advanced users that don't need a GUI. If you require a GUI please use: [Sonix-Flaser](https://github.com/SonixQMK/sonix-flasher).

Features:

- [x] Minimal dependencies
- [x] Cross-platform
- [x] Faster

## Getting Started

### Dependencies

Clone this repository recursively:
```
git clone --recursive https://github.com/SonixQMK/SonixFlasherC
```

If using windows, please install MinGW

### Compiling

Compile using:

```
make sonixflasher
```


### Running the flasher

```
./sonixflasher
```


## License

This project is licensed under the GNU License - see the LICENSE.md file for details
5 changes: 4 additions & 1 deletion sonixflasher.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ int main(int argc, char* argv[])
if(vid != SONIX_VID || (pid != SN248_PID && pid != SN248B_PID && pid != SN268_PID))
{
printf("Warning: Flashing a non-sonix device, you are now on your own.\n");

// Set max firmware to 64k, useful when flashing a Sonix Board that isnt in BL mode (Redragons, Keychrons)
MAX_FIRMWARE = MAX_FIRMWARE_SN32F240; // Maybe add a param to override this (?)
}

// Set max fw size depending on VID/PID
Expand Down Expand Up @@ -403,7 +406,7 @@ int main(int argc, char* argv[])
}
}

while (file_size % 64 != 0) file_size++; // Add padded zereos (if any) to file_size
while (file_size % 64 != 0) file_size++; // Add padded zereos (if any) to file_size, since we are using a fixed 64 + 1 buffer, we need to take in consideration when the file doesnt fill the buffer.

if( ((flash_jumploader && sanity_check_jumploader_firmware(file_size)) ||
(!flash_jumploader && sanity_check_firmware(file_size, offset))) &&
Expand Down

0 comments on commit 41ae51c

Please sign in to comment.