Development Guide¶
This guide covers building, testing, and debugging the EMBSEC Lab Development Kit.
Overview¶
The EMBSEC Kit uses a modern development workflow:
- CMake for cross-platform builds
- Docker for consistent environments
- QEMU for hardware emulation
- Python for test automation
- GDB for debugging
Quick Reference¶
Essential Commands¶
# Configure and build
make setup
make build
# Run tests
make test
# Debug a lab
make debug-01-buffer-overflow
Development Sections¶
Building¶
- CMake configuration
- Build targets
- Cross-compilation
- Optimization levels
Testing¶
- Unit test framework
- Integration tests
- QEMU automation
- Coverage reports
Debugging¶
- GDB with QEMU
- Hardware debugging
- Memory analysis
- Exploit development
Environment Setup¶
- Docker development
- IDE configuration
- Tool installation
- Troubleshooting
Development Workflow¶
1. Make Changes¶
2. Build and Test¶
3. Debug Issues¶
# Start GDB session
make debug-my-lab
# Or manual QEMU + GDB
qemu-system-arm -M lm3s6965evb -kernel build/labs/my-lab/my-lab -S -gdb tcp::1234
arm-none-eabi-gdb build/labs/my-lab/my-lab
4. Submit Changes¶
Project Structure¶
kit/
├── sdk/ # Core SDK library
├── labs/ # Security challenge labs
├── tools/ # Build and test tools
├── docs/ # Documentation (you are here)
└── CMakeLists.txt # Root build configuration
Common Tasks¶
Adding a New Lab¶
- Copy template:
cp -r labs/template labs/my-lab - Update
labs/my-lab/metadata.yml - Implement vulnerability in
src/main.c - Write tests in
tests/test_lab.py - Add to
labs/CMakeLists.txt
Updating SDK¶
- Modify headers in
sdk/include/ - Update implementation in
sdk/src/ - Add tests to
sdk/tests/ - Update documentation
Creating Exploits¶
- Use
tools/scripts/exploit_template.py - Test with QEMU
- Verify with hardware
- Document approach
Best Practices¶
- Test Early: Run tests after every change
- Use Docker: Ensures consistent builds
- Document Code: Update docs with API changes
- Security First: Consider security implications
- Cross-Platform: Test on multiple systems