Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8565855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:31:28+00:00 2026-06-11T17:31:28+00:00

I am new to atmega8. I convert some old freesacle code into atmega8. but

  • 0

I am new to atmega8. I convert some old freesacle code into atmega8. but seems my chip can not hold code more than 2400 bytes? below is result, when code is 2412 bytes… all things become mess.

code below avrdude is comes from “cat /dev/ttyUSB0”. my debug informations.

avrdude: verifying ...
avrdude: 2412 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

55432111001-0000 6Gn�H(�h�X0443234554321190 6Gn�H        (�h�X0443234554321100-FD-90-6F55432111001-0000 6Gn�H    (�h�X0443234554321190 6Gn�H(�h�X0443234554321100-FD-90-6F^C

but if i reduced code(only audio data), i got right result.

avrdude: verifying ...
avrdude: 2312 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

AVR-IrDA-Tone-Audio start.
version 1.2
--IrDA--    Bin: 1001-0000      Hex: 90     Complete Hex: 00-FD-90-6F

all hfuse, lfuse, lock bits are original value. my code might be 6k with some audio data.

if it is due to boot flash section?

Addtion: ————————————————————————————————–

I change crystal to 8M now.

● ll h8-*
-rw-rw-r-- 1 eexp eexp 933  9月 22 00:27 h8-reduce.c
-rw-rw-r-- 1 eexp eexp 14K  9月 22 00:26 h8-org.c

● cp h8-org.c h8.c

● avr.sh main.c
......
avrdude: 5272 bytes of flash verified

now all goes mess.

● cp h8-reduce.c h8.c

● avr.sh main.c
.....
avrdude: 1872 bytes of flash verified

now all goes right, but i lost almost all audio data.

below is h8.c.

● head h8.c
const unsigned char h8[] =
{
    36,14,0,0,129,129,128,129,130,127,126,128,128,127,128,130,131,128,127,127,127,126,127,129,130,130,129,129,128,128,128,128,128,126,126,129,128,127,127,130,133,130,126,126,129,128,125,127,128,129,128,127,129,128,127,127,127,128,128,129,127,127,129,128,130,130,128,128,127,126,128,128,128,130,129,128,129,126,126,125,127,132,130,127,126,129,131,127,127,133,133,127,122,125,129,130,127,127,130,129,
    126,125,127,128,129,128,128,128,128,127,127,129,128,129,129,128,126,127,129,127,128,127,128,130,129,129,128,128,127,127,129,130,128,128,129,129,127,127,128,128,128,128,128,128,126,126,129,129,127,129,130,130,126,126,128,128,127,128,131,130,127,126,126,128,129,125,128,130,131,128,126,129,128,129,125,126,130,129,131,130,131,129,125,128,129,131,130,127,130,129,127,128,127,129,128,126,126,127,128,126,
    127,127,128,128,128,127,127,127,127,127,129,128,129,128,128,129,129,128,128,129,128,128,128,129,0xff,
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:31:29+00:00Added an answer on June 11, 2026 at 5:31 pm

    i guess you are loading the audio data into the ram. a variable declaration like

      char* data = "somerandomdata"; 
    

    is putting all the data in the SRAM, and you just have 1kbyte of SRAM in the mega8 (which also contains the stack etc).

    if the lock bits are in their original state, the bootloader mechanism should not cause this error.

    you should specify the audio data as program space, here is the description how:

    Avr LibC PGM Space

    here is how your code should look like:
    h4.c

           #include <avr/pgmspace.h>
    
           const unsigned char h4[] PROGMEM = { 18,7,0,0,128,128,128,127,127,129,129,127,126,128,130,129,128,129,127,127,128,12‌​8,132,127,129,126,128,128,127,127,127,129,127,127,130,129,127,127,129,130,129,125‌​,
    

    you need to adjust your set_audio function,
    every reading of the pointer h4 shall be done in this way:
    change for example

      value = *h4_copy++;
    

    to

      value = pgm_read_byte(h4_copy); h4_copy++;    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to WCF, but familiar with COM+ - can I wrap a WCF service
new AutoResetEvent(false).WaitOne(Period); What is purpose of this code? Why not use Thread.Sleep instead?
new to ruby, and rails... but not to the amp stack. my preferred method
New to python, competent in a few languages, but can't see a 'snazzy' way
new to c#. I'm trying to make a simple system where I can search
New to Node.js and Express, I am trying to understand the two seems overlapping
New programmer here, I am trying to understand and break down this code below
New developer here,Im using the Custom Image Picker by ray wenderlich. But what I
New question, but really close to need to refresh page in jquery mobile .
New to objective-c and I just can't find the answer to this question anywhere.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.