Skip to content

Conversation

@clockdomain
Copy link
Collaborator

No description provided.

FerralCoder and others added 22 commits September 9, 2025 10:50
code of conduct
…upport.

Key changes:

* Add slave mode operations to I2cDevice API:
  - configure_slave_address() - Set up slave address configuration
  - enable_slave_receive() - Start listening for incoming messages
  - check_slave_buffer() - Poll for received messages
  - disable_slave_receive() - Stop slave mode
  - get_slave_messages() - Convenient structured message retrieval

* Enhance drv_i2c_types with slave mode infrastructure:
  - New Op variants for slave operations (ConfigureSlaveAddress, etc.)
  - SlaveMessage struct for structured message handling
  - SlaveConfig for slave configuration management
  - Additional ResponseCode variants for slave-specific errors

* Documentation improvements:
  - Module-level documentation with usage examples
  - Detailed function documentation with examples
  - Error handling patterns and task reset behavior explanation
  - MCTP slave configuration examples

The slave mode implementation follows Hubris patterns with polling-based
message retrieval, fixed buffer sizes, and proper IPC serialization support.
This enables protocols like PLDM-over-MCTP-over-I2C where devices need to
both send and receive management messages.
[feat] Add slave mode capabilities to Hubris I2C subsystem for MCTP
1. Build the firmware image:
```
$ cargo xtask dist app/ast1060-starter/app.toml
$ gen_uart_booting_image.sh target/ast1060-starter/dist/default/final.bin \
                            target/ast1060-starter/dist/default/uart_final.bin
```

2. Using uart_final.bin for boot from UART.

3. Using humility over jtag to verify
```
$ humility -e env.json -t ast1060 tasks
humility: attached via JLink
system time = 114057
ID TASK                       GEN PRI STATE
 0 jefe                         0   0 recv, notif: fault timer(T+43)
 1 idle                         0   5 RUNNING

$ humility -e env.json -t ast1060 stackmargin
humility: attached via JLink
ID TASK                STACKBASE  STACKSIZE   MAXDEPTH     MARGIN
 0 jefe               0x21000          1536        272       1264
 1 idle               0x20c00           256        104        152

```
Note: the humility has some bug in gdb connection.

TODO:
- Adding Secure Boot Header within final.bin
- JTAG halt at main configured by features

Signed-off-by: Troy Lee <[email protected]>
Signed-off-by: Troy Lee <[email protected]>
helloworld task will send "Hello, world!\n" to uart driver task over IPC.

Signed-off-by: Troy Lee <[email protected]>
Signed-off-by: Troy Lee <[email protected]>
Signed-off-by: Troy Lee <[email protected]>
- Add  I2cHardware trait for platform-agnostic I2C operations
-  Master mode operations: write_read, write_read_block, timing config
-  Slave mode operations for MCTP protocol support:
  * configure_slave_mode() - Set up I2C slave addressing
  * enable/disable_slave_receive() - Control slave mode operation
  * poll_slave_messages() - Retrieve received slave messages
  * get_slave_status() - Monitor slave mode health and statistics
- Define SlaveStatus struct for  slave mode monitoring
- Support cross-platform implementations (STM32, LPC55, RISC-V, etc.)
- Enable generic I2C server architecture with hardware backend selection
- Maintain existing ResponseCode error taxonomy for consistency
- Design supports MCTP-over-I2C peer-to-peer communication protocols

This establishes the foundation for a portable, generic I2C server that can
work across different microcontroller families while supporting both
legacy  master operations and slave mode requirements for
management protocols like MCTP.
- Implement lightweight mock I2C driver with optimized memory usage for 2048-byte stack limit
- Create minimal build configuration generating only notifications
- Add basic tracing for I2C transactions and slave configuration attempts
- Focus on IPC protocol compliance for testing without hardware complexity
Components added:
* app/ast1060-i2c-scaffold/: Complete application configuration
* task/i2c-client/: Comprehensive I2C test client with UART output
* drv/openprot-i2c-server/: Mock I2C server with slave mode support
* chips/ast1060/chip.toml: Complete I2C peripheral definitions
* run-*-scaffold-app.sh: QEMU and GDB execution scripts
…rver

[feat] Ast1060 App with Mock I2C Driver
@rusty1968 rusty1968 merged commit 2e28c0c into rusty1968:master Sep 25, 2025
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.

4 participants