Easy projects: Difference between revisions

From flashrom
Jump to navigation Jump to search
(ramtron)
No edit summary
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
You probably came here trying to find a small (minutes to hours) and easy task where you can get your hands dirty and get results immediately.
This page is listing small projects for the beginners, to start learning about flashrom development and do some useful tasks.


If you're a flashrom newbie, this page is for you.
If you're a flashrom newbie, this page is for you.


= Open tasks =
= Open tasks =
Important note: every task in easy projects has a topic. If you send a patch for one of the projects, please add a topic to your gerrit patch. Before sending a patch, have a look at currently open patches for the same topic, to avoid accidentally duplicating someone else's effort.
We've had situations when two contributors sent patches for the same thing (without knowing about each other), and situations like that are usually stressful and not easily resolved. Please look for patches under the topic, and add a topic to your own patches.
Topic can be added when pushing the patch, for example <tt>git push upstream HEAD:refs/for/master%topic=easy_projects_unit_tests</tt>. Alternatively topic can be added on Gerrit UI.
== Write a unit test ==
Topic: easy_projects_unit_test
Unit tests are located under tests/ directory in the tree. Have a look at existing tests, and think of what you can add. The test for easy projects can be small. Hint: it is easier to add a test scenario for the area that already has tests (for example new scenario for programmer lifecycle, given that the programmer has some tests). It is harder to write a test for the programmer that has no tests at all.
== Take a bug in a bugtracker ==
Topic: easy_projects_bugtracker
We have an "Easy projects" category in our bugtracker, and you can take a bug from there.
List of bugs in the category can be found by the [[https://ticket.coreboot.org/projects/flashrom/issues?utf8=%E2%9C%93&set_filter=1&sort=id%3Adesc&f%5B%5D=status_id&op%5Bstatus_id%5D=o&f%5B%5D=category_id&op%5Bcategory_id%5D=%3D&v%5Bcategory_id%5D%5B%5D=16&f%5B%5D=&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=category&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&group_by=&t%5B%5D link]]
== Fix issues found by scan-build ==
Topic: easy_project_scan_build
Run scan-build in the tree:
<tt>make clean && CFLAGS='-fsanitize=leak' scan-build make</tt>
At the moment of writing this, it produces around 30 issues, which means there are plenty of easy projects.
In general, one issue == one Easy project. However, you can fix more than one issue in the same patch if there are multiple occurrences of the same issue in the same file.
You need to install clang-tools for this project.


== Find chips without voltage data ==
== Find chips without voltage data ==
Topic: easy_project_chips_voltage
We have added allowed supply voltage ranges (usually denoted VCC in datasheets) to the chip definitions in flashchips.c, but not all of them.
We have added allowed supply voltage ranges (usually denoted VCC in datasheets) to the chip definitions in flashchips.c, but not all of them.
Complete the list by looking for the right datasheet and editing flashchips.c accordingly.
Complete the list by looking for the right datasheet and editing flashchips.c accordingly.


== Find boards that have a board enable but are not mentioned in print.c ==
== Find boards that have a board enable but are not mentioned in print.c ==
Topic: easy_projects_boards
There may be a few boards that had a [[Board Enable]] added (in board_enable.c) but which were not added to the array named boards_known in print.c (usually by mistake).
There may be a few boards that had a [[Board Enable]] added (in board_enable.c) but which were not added to the array named boards_known in print.c (usually by mistake).


Find those and send a list or even a patch for print.c to the mailing list.
Find those and send a list or even a patch for print.c to the mailing list.


Even better would be an automatic detection of such mistakes.
We already do some sanity checks on startup (cf. <tt>selfcheck()</tt> in <tt>flashrom.c</tt>).


== Add timing info to flash chip definitions (mostly done) ==
== Add timing info to flash chip definitions (mostly done) ==
Topic: easy_project_chip_timing


Go through the list of flash chips in flashchips.c inside the flashrom source. For each chip (except SPI chips), read through the data sheets and add a comment to the flash chip definition which contains the timing information in microseconds(!) for the probe sequence.
Go through the list of flash chips in flashchips.c inside the flashrom source. For each chip (except SPI chips), read through the data sheets and add a comment to the flash chip definition which contains the timing information in microseconds(!) for the probe sequence.
Line 24: Line 61:


== Add new flash chip definitions ==
== Add new flash chip definitions ==
Topic: easy_project_new_chip


We have a few dozen chip IDs listed in flash.h, but not in flashchips.c. Find them, dig up the data sheets and add chip definitions for them to flashchips.c. You can use similar flash chips as a guideline. Check our list of pending patches (http://patchwork.coreboot.org/project/flashrom/list/) to not duplicate someone's work. Reviewing any pending patches by verifying the values in the patches is of course also very welcomed too!
We have a few dozen chip IDs listed in flash.h, but not in flashchips.c. You can find them by running '''util/list_yet_unsupported_chips.sh'''. Then dig up the data sheets and add chip definitions for them to flashchips.c. You can use similar flash chips as a guideline. Check our list of pending patches (http://patchwork.coreboot.org/project/flashrom/list/) to not duplicate someone's work. Reviewing any pending patches by verifying the values in the patches is of course also very welcomed too! The process of adding a chip and the needed data structures are explained [[Development_Guidelines#Adding.2Freviewing_a_new_flash_chip|here]].


This will reduce the number of undetected chips.
This will reduce the number of undetected chips and every added chip broadens flashrom support.


Every added chip broadens flashrom support.
== Add (ferroelectric, F-RAM) SPI chips made by Cypress / Ramtron ==
Topic: easy_project_cypress_ramtron


== Test flashrom ==
http://www.cypress.com/products/f-ram-serial


Please see the [[Board Testing HOWTO]].
Example datasheet: http://www.cypress.com/file/41676/download


== Add automatic uploading of log files ==
These work mostly like SPI flashes, except for (these are just the biggest points):
* No erase command (or erasing necessary)
* 2-byte addresses (atleast for smaller/older devices)


We have a pastebin at http://paste.flashrom.org. Create a patch that (if enabled) automatically uploads the output of a flashrom run to it using [http://curl.haxx.se/libcurl/ libcurl] or a similar library (free license, cross-platform).
== Test flashrom ==
Topic: easy_project_test_flashrom


== Add support for multiple slaves to the ft2232_spi programmer ==
Please see the [[Board Testing HOWTO]].
 
The FT232H for example has 4 generic GPIO pins that could be used as additional CS pins. Think about useful command line arguments (what about other programmers that support similar functionality, e.g. by supporting multiple CS pins natively?) before you start.
An example how this could look like [http://patchwork.coreboot.org/patch/3660/ exists] already.
 
== Add (ferroelectric) SPI chips made by Ramtron ==
http://www.ramtron.com/products/nonvolatile-memory/serial.aspx
 
= Done =
 
== Tag SPI chips in flashchips.c with the status register write command according to their datasheets ==


Usually the status register of SPI chips is write protected and has to be made accessible by one of two possible commands (or by either one). We indicate this by setting 2 bits in the feature flags of the chip definition in flashchips.c.
== Replace programmer_delay() with internal_sleep() where appropriate ==
The default is EWSR (see spi_write_status_register in spi25.c) and so no chips needing this have been tagged correctly (yet!).
Topic: easy_project_delay
The task is to look at all chip definitions with '''bustype = BUS_SPI''' and check the '''feature_bits''' field if it contains the correct '''FEATURE_WRSR_*''' flag and add/change it after looking it up in the datasheet. In case either works use FEATURE_WRSR_EITHER.
Please send a list of chips to change together with the correct flag or (preferably) a patch to the mailing list.


''Patch created by Steven Zakulec, committed in r1527.''
If a delay call does not depend on precise timing and if the '''programmer''' in question '''does not offer its own delay function''', programmer_delay() can be replaced with internal_sleep().
If a delay call does not depend on precise timing and if the delay '''should run on the host''', programmer_delay() can be replaced with internal_sleep().

Latest revision as of 10:39, 3 March 2023

This page is listing small projects for the beginners, to start learning about flashrom development and do some useful tasks.

If you're a flashrom newbie, this page is for you.

Open tasks

Important note: every task in easy projects has a topic. If you send a patch for one of the projects, please add a topic to your gerrit patch. Before sending a patch, have a look at currently open patches for the same topic, to avoid accidentally duplicating someone else's effort.

We've had situations when two contributors sent patches for the same thing (without knowing about each other), and situations like that are usually stressful and not easily resolved. Please look for patches under the topic, and add a topic to your own patches.

Topic can be added when pushing the patch, for example git push upstream HEAD:refs/for/master%topic=easy_projects_unit_tests. Alternatively topic can be added on Gerrit UI.

Write a unit test

Topic: easy_projects_unit_test

Unit tests are located under tests/ directory in the tree. Have a look at existing tests, and think of what you can add. The test for easy projects can be small. Hint: it is easier to add a test scenario for the area that already has tests (for example new scenario for programmer lifecycle, given that the programmer has some tests). It is harder to write a test for the programmer that has no tests at all.

Take a bug in a bugtracker

Topic: easy_projects_bugtracker

We have an "Easy projects" category in our bugtracker, and you can take a bug from there. List of bugs in the category can be found by the [link]

Fix issues found by scan-build

Topic: easy_project_scan_build

Run scan-build in the tree:

make clean && CFLAGS='-fsanitize=leak' scan-build make

At the moment of writing this, it produces around 30 issues, which means there are plenty of easy projects.

In general, one issue == one Easy project. However, you can fix more than one issue in the same patch if there are multiple occurrences of the same issue in the same file.

You need to install clang-tools for this project.

Find chips without voltage data

Topic: easy_project_chips_voltage

We have added allowed supply voltage ranges (usually denoted VCC in datasheets) to the chip definitions in flashchips.c, but not all of them. Complete the list by looking for the right datasheet and editing flashchips.c accordingly.

Find boards that have a board enable but are not mentioned in print.c

Topic: easy_projects_boards

There may be a few boards that had a Board Enable added (in board_enable.c) but which were not added to the array named boards_known in print.c (usually by mistake).

Find those and send a list or even a patch for print.c to the mailing list.

Even better would be an automatic detection of such mistakes. We already do some sanity checks on startup (cf. selfcheck() in flashrom.c).

Add timing info to flash chip definitions (mostly done)

Topic: easy_project_chip_timing

Go through the list of flash chips in flashchips.c inside the flashrom source. For each chip (except SPI chips), read through the data sheets and add a comment to the flash chip definition which contains the timing information in microseconds(!) for the probe sequence.

This will make probing a lot more reliable.

Every annotated chip helps.

Add new flash chip definitions

Topic: easy_project_new_chip

We have a few dozen chip IDs listed in flash.h, but not in flashchips.c. You can find them by running util/list_yet_unsupported_chips.sh. Then dig up the data sheets and add chip definitions for them to flashchips.c. You can use similar flash chips as a guideline. Check our list of pending patches (http://patchwork.coreboot.org/project/flashrom/list/) to not duplicate someone's work. Reviewing any pending patches by verifying the values in the patches is of course also very welcomed too! The process of adding a chip and the needed data structures are explained here.

This will reduce the number of undetected chips and every added chip broadens flashrom support.

Add (ferroelectric, F-RAM) SPI chips made by Cypress / Ramtron

Topic: easy_project_cypress_ramtron

http://www.cypress.com/products/f-ram-serial

Example datasheet: http://www.cypress.com/file/41676/download

These work mostly like SPI flashes, except for (these are just the biggest points):

  • No erase command (or erasing necessary)
  • 2-byte addresses (atleast for smaller/older devices)

Test flashrom

Topic: easy_project_test_flashrom

Please see the Board Testing HOWTO.

Replace programmer_delay() with internal_sleep() where appropriate

Topic: easy_project_delay

If a delay call does not depend on precise timing and if the programmer in question does not offer its own delay function, programmer_delay() can be replaced with internal_sleep(). If a delay call does not depend on precise timing and if the delay should run on the host, programmer_delay() can be replaced with internal_sleep().