Updated from 6:02 p.m. EDTSAN FRANCISCO -- Sirf Technology ( SIRF) posted a large loss in the second quarter, as hefty writedowns and weak demand took a toll on the troubled chipmaker. Sirf said its gross margin was cut in half to 21%, compared with 42.6% in the first quarter. "This was a challenging quarter for Sirf with weakness in demand from our OEM and ODM customers, especially in the portable navigation device space, and continued competitive pressures that impacted both our revenue and margins," Sirf said in a statement. And the third quarter doesn't look much better: Sirf said during its conference call that it expects revenue in the current quarter between $60 million and $64 million, vs. the $69.9 million expected by analyst. The company said adjusted EPS will range between a loss of 17 cents to a loss of 21 cents. Analysts were looking for the company to breakeven, excluding stock compensation expenses. Shares of Sirf fell more than 12% in recent after-hours trading to $3.70. The San Jose, Calif., maker of GPS chips posted a second-quarter loss of $332.6 million, or $5.41 a share, in the second quarter, compared with a profit of $2.1 million, or 4 cents, at this time last year. Sirf said the loss included a $215.7 million goodwill impairment charge, as well as some $90 million in special charges for items including impairment to acquisition-related intangibles and note receivables, as well as income tax provisions and stock compensation expenses. Excluding most items, but including $10.3 million in stock compensation expense, the company lost 19 cents a share. Using current share counts, the company lost 29 cents a share excluding stock expense; analysts polled by Thomson Reuters were expecting a 28-cent-a-share loss on that basis. Sales in the three months ended June 30 totaled $63.1 million, compared with $70.6 million at this time last year. The average analyst expectation was $62 million.