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

2 Bugs in new fatfs_create_spiflash_image() feature (IDFGH-6383) #8042

Closed
m24h opened this issue Dec 8, 2021 · 5 comments · Fixed by #8169
Closed

2 Bugs in new fatfs_create_spiflash_image() feature (IDFGH-6383) #8042

m24h opened this issue Dec 8, 2021 · 5 comments · Fixed by #8169
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@m24h
Copy link

m24h commented Dec 8, 2021

Environment

  • Development Kit: none
  • Kit version (for WroverKit/PicoKit/DevKitC): none
  • Module or chip used: ESP32-WROOM-32
  • IDF version: master at 2021-12-9
  • Build System: idf.py
  • Compiler version : (crosstool-NG esp-2021r2) 8.4.0
  • Operating System: Windows
  • (Windows only) environment type:ESP Command Prompt
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

When I use the new fatfs_create_spiflash_image() feature in fatfs componenet, like following usage in CMakeLists.txt:
--------------------begining--------------------------------
fatfs_create_spiflash_image(resource resource FLASH_IN_PROJECT)
---------------------end-------------------------------

Then something got wrong like following logs at the building time:
-----------------------------begining------------------------------------------------
Traceback (most recent call last):
File "D:/ESPIDF/components/fatfs/wl_fatfsgen.py", line 196, in
wl_fatfs.wl_generate(input_dir)
File "D:/ESPIDF/components/fatfs/wl_fatfsgen.py", line 175, in wl_generate
self.plain_fatfs.generate(input_directory=input_directory)
File "D:\ESPIDF\components\fatfs\fatfsgen.py", line 190, in generate
self._generate_partition_from_folder(folder_name, folder_path=path_to_folder, is_dir=True)
File "D:\ESPIDF\components\fatfs\fatfsgen.py", line 183, in _generate_partition_from_folder
self._generate_partition_from_folder(os.path.join(smaller_path, path), folder_path=folder_path)
File "D:\ESPIDF\components\fatfs\fatfsgen.py", line 183, in _generate_partition_from_folder
self._generate_partition_from_folder(os.path.join(smaller_path, path), folder_path=folder_path)
File "D:\ESPIDF\components\fatfs\fatfsgen.py", line 171, in _generate_partition_from_folder
content = file.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x83 in position 1418: illegal multibyte sequence
----------------------------------end--------------------------------
it seens that fatfs partition generator wants to encode my raw file and failed.
I modified the file wl_fatfsgen.py, at line 168, added "wb" instruction as "with open(output_path, 'wb') as output:", and modified the file fs_object.py, at line 50, removed "encode()" method as "content_as_list = content_part", then it seens to work right.

But why does fatfs generator want to encode a file being put to a partition, is it enough to just treat the file as an unkown binary raw file.

Another bug is that the created partion burned into flash, will pollute the partition just next to it, cause mounting failure like following logs:
--------------------------begining-------------------------
W (260) vfs_fat_spiflash: f_mount failed (13)
--------------------------end-------------------------

I reserved a gap between those two partition, the problem seens to be temporary solved.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 8, 2021
@github-actions github-actions bot changed the title 2 Bugs in new fatfs_create_spiflash_image() feature 2 Bugs in new fatfs_create_spiflash_image() feature (IDFGH-6383) Dec 8, 2021
@dobairoland
Copy link
Collaborator

Thanks for your report. We will investigate this soon.

Could you please share the output of python --version run in your terminal?

@sio13
Copy link
Contributor

sio13 commented Dec 16, 2021

Hi @m24h, thanks a lot for sharing the information about the issue. "encode()" seems to be redundant and we'll consider removing it. Thank you for this as well. Regarding the second problem, would it be possible to share your partition table?

@m24h
Copy link
Author

m24h commented Dec 16, 2021 via email

@m24h
Copy link
Author

m24h commented Dec 16, 2021 via email

@sio13
Copy link
Contributor

sio13 commented Dec 16, 2021

Hi @m24h, thanks a lot for providing the information. I will test it on my own and resolve the encoding issue.

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants